use of org.apache.syncope.client.console.widgets.BaseExtWidget in project syncope by apache.
the class Dashboard method buildTabList.
private List<ITab> buildTabList() {
final List<ITab> tabs = new ArrayList<>();
tabs.add(new AbstractTab(new ResourceModel("overview")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new DashboardOverviewPanel(panelId);
}
});
tabs.add(new AbstractTab(new ResourceModel("accessTokens")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new DashboardAccessTokensPanel(panelId, getPageReference());
}
});
tabs.add(new AbstractTab(new ResourceModel("control")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new DashboardControlPanel(panelId, getPageReference());
}
});
ClassPathScanImplementationLookup classPathScanImplementationLookup = (ClassPathScanImplementationLookup) SyncopeConsoleApplication.get().getServletContext().getAttribute(ConsoleInitializer.CLASSPATH_LOOKUP);
final List<Class<? extends BaseExtWidget>> extWidgetClasses = classPathScanImplementationLookup.getExtWidgetClasses();
if (!extWidgetClasses.isEmpty()) {
tabs.add(new AbstractTab(new ResourceModel("extensions")) {
private static final long serialVersionUID = -6815067322125799251L;
@Override
public Panel getPanel(final String panelId) {
return new DashboardExtensionsPanel(panelId, extWidgetClasses, getPageReference());
}
});
}
return tabs;
}
use of org.apache.syncope.client.console.widgets.BaseExtWidget in project syncope by apache.
the class ClassPathScanImplementationLookup method load.
@SuppressWarnings("unchecked")
public void load() {
pages = new ArrayList<>();
previewers = new ArrayList<>();
extPages = new ArrayList<>();
extWidgets = new ArrayList<>();
ssoLoginFormPanels = new ArrayList<>();
reportletConfs = new HashMap<>();
accountRuleConfs = new HashMap<>();
passwordRuleConfs = new HashMap<>();
pullCorrelationRuleConfs = new HashMap<>();
ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
scanner.addIncludeFilter(new AssignableTypeFilter(BasePage.class));
scanner.addIncludeFilter(new AssignableTypeFilter(AbstractBinaryPreviewer.class));
scanner.addIncludeFilter(new AssignableTypeFilter(BaseExtPage.class));
scanner.addIncludeFilter(new AssignableTypeFilter(BaseExtWidget.class));
scanner.addIncludeFilter(new AssignableTypeFilter(SSOLoginFormPanel.class));
scanner.addIncludeFilter(new AssignableTypeFilter(ReportletConf.class));
scanner.addIncludeFilter(new AssignableTypeFilter(AccountRuleConf.class));
scanner.addIncludeFilter(new AssignableTypeFilter(PasswordRuleConf.class));
scanner.addIncludeFilter(new AssignableTypeFilter(PullCorrelationRuleConf.class));
scanner.findCandidateComponents(getBasePackage()).forEach(bd -> {
try {
Class<?> clazz = ClassUtils.resolveClassName(bd.getBeanClassName(), ClassUtils.getDefaultClassLoader());
boolean isAbsractClazz = Modifier.isAbstract(clazz.getModifiers());
if (!isAbsractClazz) {
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 (BaseExtWidget.class.isAssignableFrom(clazz)) {
if (clazz.isAnnotationPresent(ExtWidget.class)) {
extWidgets.add((Class<? extends BaseExtWidget>) clazz);
} else {
LOG.error("Could not find annotation {} in {}, ignoring", ExtWidget.class.getName(), clazz.getName());
}
} else if (BasePage.class.isAssignableFrom(clazz)) {
pages.add((Class<? extends BasePage>) clazz);
} else if (AbstractBinaryPreviewer.class.isAssignableFrom(clazz)) {
previewers.add((Class<? extends AbstractBinaryPreviewer>) clazz);
} else if (SSOLoginFormPanel.class.isAssignableFrom(clazz)) {
ssoLoginFormPanels.add((Class<? extends SSOLoginFormPanel>) clazz);
} else if (ReportletConf.class.isAssignableFrom(clazz)) {
reportletConfs.put(clazz.getName(), (Class<? extends ReportletConf>) clazz);
} else if (AccountRuleConf.class.isAssignableFrom(clazz)) {
accountRuleConfs.put(clazz.getName(), (Class<? extends AccountRuleConf>) clazz);
} else if (PasswordRuleConf.class.isAssignableFrom(clazz)) {
passwordRuleConfs.put(clazz.getName(), (Class<? extends PasswordRuleConf>) clazz);
} else if (PullCorrelationRuleConf.class.isAssignableFrom(clazz)) {
pullCorrelationRuleConfs.put(clazz.getName(), (Class<? extends PullCorrelationRuleConf>) clazz);
}
}
} catch (Throwable t) {
LOG.warn("Could not inspect class {}", bd.getBeanClassName(), t);
}
});
pages = Collections.unmodifiableList(pages);
previewers = Collections.unmodifiableList(previewers);
Collections.sort(extPages, (o1, o2) -> ObjectUtils.compare(o1.getAnnotation(ExtPage.class).priority(), o2.getAnnotation(ExtPage.class).priority()));
extPages = Collections.unmodifiableList(extPages);
Collections.sort(extWidgets, (o1, o2) -> ObjectUtils.compare(o1.getAnnotation(ExtWidget.class).priority(), o2.getAnnotation(ExtWidget.class).priority()));
extWidgets = Collections.unmodifiableList(extWidgets);
ssoLoginFormPanels = Collections.unmodifiableList(ssoLoginFormPanels);
reportletConfs = Collections.unmodifiableMap(reportletConfs);
accountRuleConfs = Collections.unmodifiableMap(accountRuleConfs);
passwordRuleConfs = Collections.unmodifiableMap(passwordRuleConfs);
pullCorrelationRuleConfs = Collections.unmodifiableMap(pullCorrelationRuleConfs);
LOG.debug("Binary previewers found: {}", previewers);
LOG.debug("Extension pages found: {}", extPages);
LOG.debug("Extension widgets found: {}", extWidgets);
LOG.debug("SSO Login pages found: {}", ssoLoginFormPanels);
LOG.debug("Reportlet configurations found: {}", reportletConfs);
LOG.debug("Account Rule configurations found: {}", accountRuleConfs);
LOG.debug("Password Rule configurations found: {}", passwordRuleConfs);
LOG.debug("Pull Correlation Rule configurations found: {}", pullCorrelationRuleConfs);
}
Aggregations