Search in sources :

Example 1 with StringUtils.contains

use of org.apache.commons.lang3.StringUtils.contains in project eol-globi-data by jhpoelen.

the class CitationUtil method citationFor.

public static String citationFor(Dataset dataset) {
    String defaultCitation = "<" + dataset.getArchiveURI().toString() + ">";
    String citation = citationOrDefaultFor(dataset, defaultCitation);
    if (!StringUtils.contains(citation, "doi.org") && !StringUtils.contains(citation, "doi:")) {
        String citationTrimmed = StringUtils.trim(defaultString(citation));
        String doiTrimmed = defaultString(dataset.getDOI());
        if (StringUtils.isBlank(doiTrimmed)) {
            citation = citationTrimmed;
        } else {
            citation = citationTrimmed + separatorFor(citationTrimmed) + doiTrimmed;
        }
    }
    return StringUtils.trim(citation);
}
Also used : StringUtils.defaultString(org.apache.commons.lang3.StringUtils.defaultString)

Example 2 with StringUtils.contains

use of org.apache.commons.lang3.StringUtils.contains in project Awful.apk by Awful.

the class ThreadDisplayFragment method showUrlMenu.

private void showUrlMenu(final String url) {
    if (url == null) {
        Timber.w("Passed null URL to #showUrlMenu!");
        return;
    }
    FragmentManager fragmentManager = getFragmentManager();
    if (fragmentManager == null) {
        Timber.w("showUrlMenu called but can't get FragmentManager!");
        return;
    }
    boolean isImage = false;
    boolean isGif = false;
    // TODO: parsing fails on magic webdev urls like http://tpm2016.zoffix.com/#/40
    // it thinks the # is the start of the ref section of the url, so the Path for that url is '/'
    Uri path = Uri.parse(url);
    String lastSegment = path.getLastPathSegment();
    // null-safe path checking (there may be no path segments, e.g. a link to a domain name)
    if (lastSegment != null) {
        lastSegment = lastSegment.toLowerCase();
        // using 'contains' instead of 'ends with' in case of any url suffix shenanigans, like twitter's ".jpg:large"
        isImage = (StringUtils.indexOfAny(lastSegment, ".jpg", ".jpeg", ".png", ".gif") != -1 && !StringUtils.contains(lastSegment, ".gifv")) || (lastSegment.equals("attachment.php") && path.getHost().equals("forums.somethingawful.com"));
        isGif = StringUtils.contains(lastSegment, ".gif") && !StringUtils.contains(lastSegment, ".gifv");
    }
    // TODO: 28/04/2017 remove all this when Crashlytics #717 is fixed
    if (AwfulApplication.crashlyticsEnabled()) {
        Crashlytics.setString("Menu for URL:", url);
        Crashlytics.setInt("Thread ID", getThreadId());
        Crashlytics.setInt("Page", getPageNumber());
        FragmentActivity activity = getActivity();
        Crashlytics.setBool("Activity exists", activity != null);
        if (activity != null) {
            String state = "Activity:";
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                state += (activity.isDestroyed()) ? "IS_DESTROYED " : "";
            }
            state += (activity.isFinishing()) ? "IS_FINISHING" : "";
            state += (activity.isChangingConfigurations()) ? "IS_CHANGING_CONFIGURATIONS" : "";
            Crashlytics.setString("Activity state:", state);
        }
        Crashlytics.setBool("Thread display fragment resumed", isResumed());
        Crashlytics.setBool("Thread display fragment attached", isAdded());
        Crashlytics.setBool("Thread display fragment removing", isRemoving());
    }
    // //////////////////////////////////////////////////////////////////////
    UrlContextMenu linkActions = UrlContextMenu.newInstance(url, isImage, isGif, isGif ? "Getting file size" : null);
    if (isGif) {
        queueRequest(new ImageSizeRequest(url, result -> {
            if (linkActions == null) {
                return;
            }
            String size = result == null ? "unknown" : Formatter.formatShortFileSize(getContext(), result);
            linkActions.setSubheading(String.format("Size: %s", size));
        }));
    }
    linkActions.setTargetFragment(ThreadDisplayFragment.this, -1);
    linkActions.show(fragmentManager, "Link Actions");
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) JavascriptInterface(android.webkit.JavascriptInterface) IgnoreRequest(com.ferg.awfulapp.task.IgnoreRequest) Constants(com.ferg.awfulapp.constants.Constants) SwipyRefreshLayoutDirection(com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayoutDirection) Bundle(android.os.Bundle) AwfulRequest(com.ferg.awfulapp.task.AwfulRequest) RedirectTask(com.ferg.awfulapp.task.RedirectTask) PackageManager(android.content.pm.PackageManager) MarkLastReadRequest(com.ferg.awfulapp.task.MarkLastReadRequest) AwfulURL(com.ferg.awfulapp.thread.AwfulURL) Uri(android.net.Uri) BookmarkRequest(com.ferg.awfulapp.task.BookmarkRequest) CloseOpenRequest(com.ferg.awfulapp.task.CloseOpenRequest) SwipyRefreshLayout(com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout) ThreadDisplay(com.ferg.awfulapp.thread.ThreadDisplay) WebViewJsInterface(com.ferg.awfulapp.webview.WebViewJsInterface) StringUtils(org.apache.commons.lang3.StringUtils) Manifest(android.Manifest) CookieManager(android.webkit.CookieManager) Handler(android.os.Handler) Keys(com.ferg.awfulapp.preferences.Keys) Map(java.util.Map) WebViewClient(android.webkit.WebViewClient) View(android.view.View) CookieSyncManager(android.webkit.CookieSyncManager) WebView(android.webkit.WebView) LoaderManager(android.support.v4.app.LoaderManager) ColorProvider(com.ferg.awfulapp.provider.ColorProvider) FloatingActionButton(android.support.design.widget.FloatingActionButton) AwfulUtils(com.ferg.awfulapp.util.AwfulUtils) AsyncTask(android.os.AsyncTask) AwfulThread(com.ferg.awfulapp.thread.AwfulThread) MenuItemCompat(android.support.v4.view.MenuItemCompat) ContextCompat(android.support.v4.content.ContextCompat) PostContextMenu(com.ferg.awfulapp.popupmenu.PostContextMenu) ViewGroup(android.view.ViewGroup) Timber(timber.log.Timber) ContentObserver(android.database.ContentObserver) AwfulError(com.ferg.awfulapp.util.AwfulError) AlertDialog(android.app.AlertDialog) DownloadManager(android.app.DownloadManager) AwfulPost(com.ferg.awfulapp.thread.AwfulPost) List(java.util.List) TextView(android.widget.TextView) InflateException(android.view.InflateException) FragmentActivity(android.support.v4.app.FragmentActivity) SinglePostRequest(com.ferg.awfulapp.task.SinglePostRequest) ReportRequest(com.ferg.awfulapp.task.ReportRequest) Nullable(android.support.annotation.Nullable) Request(android.app.DownloadManager.Request) AwfulMessage(com.ferg.awfulapp.thread.AwfulMessage) Context(android.content.Context) VoteRequest(com.ferg.awfulapp.task.VoteRequest) AwfulProvider(com.ferg.awfulapp.provider.AwfulProvider) Environment(android.os.Environment) DownloadListener(android.webkit.DownloadListener) Intent(android.content.Intent) CursorLoader(android.support.v4.content.CursorLoader) ShareActionProvider(android.support.v7.widget.ShareActionProvider) HashMap(java.util.HashMap) NonNull(android.support.annotation.NonNull) LoggingWebChromeClient(com.ferg.awfulapp.webview.LoggingWebChromeClient) ProfileRequest(com.ferg.awfulapp.task.ProfileRequest) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) NetworkUtils(com.ferg.awfulapp.network.NetworkUtils) PageBar(com.ferg.awfulapp.widget.PageBar) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) Menu(android.view.Menu) Build(android.os.Build) LinkedList(java.util.LinkedList) PostRequest(com.ferg.awfulapp.task.PostRequest) DialogInterface(android.content.DialogInterface) Cursor(android.database.Cursor) Formatter(android.text.format.Formatter) UrlContextMenu(com.ferg.awfulapp.popupmenu.UrlContextMenu) Loader(android.support.v4.content.Loader) AwfulTheme(com.ferg.awfulapp.provider.AwfulTheme) LayoutInflater(android.view.LayoutInflater) AwfulPreferences(com.ferg.awfulapp.preferences.AwfulPreferences) AwfulPagedItem(com.ferg.awfulapp.thread.AwfulPagedItem) TYPE(com.ferg.awfulapp.thread.AwfulURL.TYPE) TextUtils(android.text.TextUtils) VolleyError(com.android.volley.VolleyError) ResolveInfo(android.content.pm.ResolveInfo) Color(android.graphics.Color) PagePicker(com.ferg.awfulapp.widget.PagePicker) FragmentManager(android.support.v4.app.FragmentManager) Crashlytics(com.crashlytics.android.Crashlytics) AwfulWebView(com.ferg.awfulapp.webview.AwfulWebView) ImageSizeRequest(com.ferg.awfulapp.task.ImageSizeRequest) Activity(android.app.Activity) EditText(android.widget.EditText) ContentUris(android.content.ContentUris) FragmentActivity(android.support.v4.app.FragmentActivity) UrlContextMenu(com.ferg.awfulapp.popupmenu.UrlContextMenu) Uri(android.net.Uri) ImageSizeRequest(com.ferg.awfulapp.task.ImageSizeRequest)

Example 3 with StringUtils.contains

use of org.apache.commons.lang3.StringUtils.contains in project azure-tools-for-java by Microsoft.

the class AzureSdkTreePanel method loadData.

private void loadData(final Map<String, List<AzureSdkCategoryEntity>> categoryToServiceMap, final List<? extends AzureSdkServiceEntity> services, String... filters) {
    final DefaultMutableTreeNode root = (DefaultMutableTreeNode) this.model.getRoot();
    root.removeAllChildren();
    final Map<String, AzureSdkServiceEntity> serviceMap = services.stream().collect(Collectors.toMap(e -> getServiceKeyByName(e.getName()), e -> e));
    final List<String> categories = categoryToServiceMap.keySet().stream().filter(StringUtils::isNotBlank).sorted((s1, s2) -> StringUtils.contains(s1, "Others") ? 1 : StringUtils.contains(s2, "Others") ? -1 : s1.compareTo(s2)).collect(Collectors.toList());
    for (final String category : categories) {
        // no feature found for current category
        if (CollectionUtils.isEmpty(categoryToServiceMap.get(category)) || categoryToServiceMap.get(category).stream().allMatch(e -> Objects.isNull(serviceMap.get(getServiceKeyByName(e.getServiceName()))) || CollectionUtils.isEmpty(serviceMap.get(getServiceKeyByName(e.getServiceName())).getContent()))) {
            continue;
        }
        // add features for current category
        final MutableTreeNode categoryNode = new DefaultMutableTreeNode(category);
        final boolean categoryMatched = this.isMatchedFilters(category, filters);
        categoryToServiceMap.get(category).stream().sorted(Comparator.comparing(AzureSdkCategoryEntity::getServiceName)).forEach(categoryService -> {
            final AzureSdkServiceEntity service = serviceMap.get(getServiceKeyByName(categoryService.getServiceName()));
            this.loadServiceData(service, categoryService, categoryNode, filters);
        });
        if (ArrayUtils.isEmpty(filters) || categoryMatched || categoryNode.getChildCount() > 0) {
            this.model.insertNodeInto(categoryNode, root, root.getChildCount());
        }
    }
    this.model.reload();
    if (ArrayUtils.isNotEmpty(filters)) {
        TreeUtil.expandAll(this.tree);
    }
    TreeUtil.promiseSelectFirstLeaf(this.tree);
}
Also used : Arrays(java.util.Arrays) AllIcons(com.intellij.icons.AllIcons) AzureSdkCategoryService(com.microsoft.azure.toolkit.intellij.azuresdk.service.AzureSdkCategoryService) Presentation(com.intellij.openapi.actionSystem.Presentation) StringUtils(org.apache.commons.lang3.StringUtils) Map(java.util.Map) CommonActionsManager(com.intellij.ide.CommonActionsManager) DefaultTreeModel(javax.swing.tree.DefaultTreeModel) TreePath(javax.swing.tree.TreePath) TailingDebouncer(com.microsoft.azure.toolkit.lib.common.utils.TailingDebouncer) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) Collectors(java.util.stream.Collectors) DefaultTreeExpander(com.intellij.ide.DefaultTreeExpander) MutableTreeNode(javax.swing.tree.MutableTreeNode) JBScrollPane(com.intellij.ui.components.JBScrollPane) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Objects(java.util.Objects) IdeBundle(com.intellij.ide.IdeBundle) RelativeFont(com.intellij.ui.RelativeFont) List(java.util.List) SimpleTree(com.intellij.ui.treeStructure.SimpleTree) ActionPlaces(com.intellij.openapi.actionSystem.ActionPlaces) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) Optional(java.util.Optional) TextDocumentListenerAdapter(com.microsoft.azure.toolkit.intellij.common.TextDocumentListenerAdapter) NotNull(org.jetbrains.annotations.NotNull) AzureTaskManager(com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager) Setter(lombok.Setter) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation) Getter(lombok.Getter) ActionToolbarImpl(com.intellij.openapi.actionSystem.impl.ActionToolbarImpl) SearchTextField(com.intellij.ui.SearchTextField) ArrayUtils(org.apache.commons.lang3.ArrayUtils) NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) CollectionUtils(org.apache.commons.collections4.CollectionUtils) AzureSdkLibraryService(com.microsoft.azure.toolkit.intellij.azuresdk.service.AzureSdkLibraryService) ActivityTracker(com.intellij.ide.ActivityTracker) Tree(com.intellij.ui.treeStructure.Tree) TreeUtil(com.intellij.util.ui.tree.TreeUtil) AnimatedIcon(com.intellij.ui.AnimatedIcon) AzureSdkCategoryEntity(com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkCategoryEntity) IOException(java.io.IOException) TreeSelectionModel(javax.swing.tree.TreeSelectionModel) RenderingUtil(com.intellij.ui.render.RenderingUtil) Consumer(java.util.function.Consumer) AzureSdkFeatureEntity(com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkFeatureEntity) AzureSdkServiceEntity(com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkServiceEntity) Comparator(java.util.Comparator) javax.swing(javax.swing) AzureSdkCategoryEntity(com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkCategoryEntity) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) StringUtils(org.apache.commons.lang3.StringUtils) AzureSdkServiceEntity(com.microsoft.azure.toolkit.intellij.azuresdk.model.AzureSdkServiceEntity) MutableTreeNode(javax.swing.tree.MutableTreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 4 with StringUtils.contains

use of org.apache.commons.lang3.StringUtils.contains in project DataX by alibaba.

the class SingleTableSplitUtil method checkSplitPk.

/**
     * 检测splitPk的配置是否正确。
     * configuration为null, 是precheck的逻辑,不需要回写PK_TYPE到configuration中
     *
     */
private static Pair<Object, Object> checkSplitPk(Connection conn, String pkRangeSQL, int fetchSize, String table, String username, Configuration configuration) {
    LOG.info("split pk [sql={}] is running... ", pkRangeSQL);
    ResultSet rs = null;
    Pair<Object, Object> minMaxPK = null;
    try {
        try {
            rs = DBUtil.query(conn, pkRangeSQL, fetchSize);
        } catch (Exception e) {
            throw RdbmsException.asQueryException(DATABASE_TYPE, e, pkRangeSQL, table, username);
        }
        ResultSetMetaData rsMetaData = rs.getMetaData();
        if (isPKTypeValid(rsMetaData)) {
            if (isStringType(rsMetaData.getColumnType(1))) {
                if (configuration != null) {
                    configuration.set(Constant.PK_TYPE, Constant.PK_TYPE_STRING);
                }
                while (DBUtil.asyncResultSetNext(rs)) {
                    minMaxPK = new ImmutablePair<Object, Object>(rs.getString(1), rs.getString(2));
                }
            } else if (isLongType(rsMetaData.getColumnType(1))) {
                if (configuration != null) {
                    configuration.set(Constant.PK_TYPE, Constant.PK_TYPE_LONG);
                }
                while (DBUtil.asyncResultSetNext(rs)) {
                    minMaxPK = new ImmutablePair<Object, Object>(rs.getString(1), rs.getString(2));
                    // check: string shouldn't contain '.', for oracle
                    String minMax = rs.getString(1) + rs.getString(2);
                    if (StringUtils.contains(minMax, '.')) {
                        throw DataXException.asDataXException(DBUtilErrorCode.ILLEGAL_SPLIT_PK, "您配置的DataX切分主键(splitPk)有误. 因为您配置的切分主键(splitPk) 类型 DataX 不支持. DataX 仅支持切分主键为一个,并且类型为整数或者字符串类型. 请尝试使用其他的切分主键或者联系 DBA 进行处理.");
                    }
                }
            } else {
                throw DataXException.asDataXException(DBUtilErrorCode.ILLEGAL_SPLIT_PK, "您配置的DataX切分主键(splitPk)有误. 因为您配置的切分主键(splitPk) 类型 DataX 不支持. DataX 仅支持切分主键为一个,并且类型为整数或者字符串类型. 请尝试使用其他的切分主键或者联系 DBA 进行处理.");
            }
        } else {
            throw DataXException.asDataXException(DBUtilErrorCode.ILLEGAL_SPLIT_PK, "您配置的DataX切分主键(splitPk)有误. 因为您配置的切分主键(splitPk) 类型 DataX 不支持. DataX 仅支持切分主键为一个,并且类型为整数或者字符串类型. 请尝试使用其他的切分主键或者联系 DBA 进行处理.");
        }
    } catch (DataXException e) {
        throw e;
    } catch (Exception e) {
        throw DataXException.asDataXException(DBUtilErrorCode.ILLEGAL_SPLIT_PK, "DataX尝试切分表发生错误. 请检查您的配置并作出修改.", e);
    } finally {
        DBUtil.closeDBResources(rs, null, null);
    }
    return minMaxPK;
}
Also used : ResultSetMetaData(java.sql.ResultSetMetaData) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) DataXException(com.alibaba.datax.common.exception.DataXException) ResultSet(java.sql.ResultSet) DataXException(com.alibaba.datax.common.exception.DataXException)

Example 5 with StringUtils.contains

use of org.apache.commons.lang3.StringUtils.contains in project syncope by apache.

the class SyncopeEnduserApplication method init.

@Override
protected void init() {
    super.init();
    // read enduser.properties
    Properties props = PropertyUtils.read(getClass(), ENDUSER_PROPERTIES, "enduser.directory").getLeft();
    domain = props.getProperty("domain", SyncopeConstants.MASTER_DOMAIN);
    adminUser = props.getProperty("adminUser");
    Args.notNull(adminUser, "<adminUser>");
    anonymousUser = props.getProperty("anonymousUser");
    Args.notNull(anonymousUser, "<anonymousUser>");
    anonymousKey = props.getProperty("anonymousKey");
    Args.notNull(anonymousKey, "<anonymousKey>");
    captchaEnabled = Boolean.parseBoolean(props.getProperty("captcha"));
    Args.notNull(captchaEnabled, "<captcha>");
    xsrfEnabled = Boolean.parseBoolean(props.getProperty("xsrf"));
    Args.notNull(xsrfEnabled, "<xsrf>");
    String scheme = props.getProperty("scheme");
    Args.notNull(scheme, "<scheme>");
    String host = props.getProperty("host");
    Args.notNull(host, "<host>");
    String port = props.getProperty("port");
    Args.notNull(port, "<port>");
    String rootPath = props.getProperty("rootPath");
    Args.notNull(rootPath, "<rootPath>");
    String useGZIPCompression = props.getProperty("useGZIPCompression");
    Args.notNull(useGZIPCompression, "<useGZIPCompression>");
    maxUploadFileSizeMB = props.getProperty("maxUploadFileSizeMB") == null ? null : Integer.valueOf(props.getProperty("maxUploadFileSizeMB"));
    clientFactory = new SyncopeClientFactoryBean().setAddress(scheme + "://" + host + ":" + port + "/" + rootPath).setContentType(SyncopeClientFactoryBean.ContentType.JSON).setUseCompression(BooleanUtils.toBoolean(useGZIPCompression));
    // read customForm.json
    try (InputStream is = getClass().getResourceAsStream("/" + CUSTOM_FORM_FILE)) {
        customForm = MAPPER.readValue(is, new TypeReference<HashMap<String, CustomAttributesInfo>>() {
        });
        File enduserDir = new File(props.getProperty("enduser.directory"));
        boolean existsEnduserDir = enduserDir.exists() && enduserDir.canRead() && enduserDir.isDirectory();
        if (existsEnduserDir) {
            File customFormFile = FileUtils.getFile(enduserDir, CUSTOM_FORM_FILE);
            if (customFormFile.exists() && customFormFile.canRead() && customFormFile.isFile()) {
                customForm = MAPPER.readValue(FileUtils.openInputStream(customFormFile), new TypeReference<HashMap<String, CustomAttributesInfo>>() {
                });
            }
        }
        FileAlterationObserver observer = existsEnduserDir ? new FileAlterationObserver(enduserDir, pathname -> StringUtils.contains(pathname.getPath(), CUSTOM_FORM_FILE)) : new FileAlterationObserver(getClass().getResource("/" + CUSTOM_FORM_FILE).getFile(), pathname -> StringUtils.contains(pathname.getPath(), CUSTOM_FORM_FILE));
        FileAlterationMonitor monitor = new FileAlterationMonitor(5000);
        FileAlterationListener listener = new FileAlterationListenerAdaptor() {

            @Override
            public void onFileChange(final File file) {
                try {
                    LOG.trace("{} has changed. Reloading form customization configuration.", CUSTOM_FORM_FILE);
                    customForm = MAPPER.readValue(FileUtils.openInputStream(file), new TypeReference<HashMap<String, CustomAttributesInfo>>() {
                    });
                } catch (IOException e) {
                    e.printStackTrace(System.err);
                }
            }

            @Override
            public void onFileCreate(final File file) {
                try {
                    LOG.trace("{} has been created. Loading form customization configuration.", CUSTOM_FORM_FILE);
                    customForm = MAPPER.readValue(FileUtils.openInputStream(file), new TypeReference<HashMap<String, CustomAttributesInfo>>() {
                    });
                } catch (IOException e) {
                    e.printStackTrace(System.err);
                }
            }

            @Override
            public void onFileDelete(final File file) {
                LOG.trace("{} has been deleted. Resetting form customization configuration.", CUSTOM_FORM_FILE);
                customForm = null;
            }
        };
        observer.addListener(listener);
        monitor.addObserver(observer);
        monitor.start();
    } catch (Exception e) {
        throw new WicketRuntimeException("Could not read " + CUSTOM_FORM_FILE, e);
    }
    // mount resources
    ClassPathScanImplementationLookup classPathScanImplementationLookup = (ClassPathScanImplementationLookup) getServletContext().getAttribute(EnduserInitializer.CLASSPATH_LOOKUP);
    for (final Class<? extends AbstractResource> resource : classPathScanImplementationLookup.getResources()) {
        Resource annotation = resource.getAnnotation(Resource.class);
        if (annotation == null) {
            LOG.debug("No @Resource annotation found on {}, ignoring", resource.getName());
        } else {
            try {
                final AbstractResource instance = resource.newInstance();
                mountResource(annotation.path(), new ResourceReference(annotation.key()) {

                    private static final long serialVersionUID = -128426276529456602L;

                    @Override
                    public IResource getResource() {
                        return instance;
                    }
                });
            } catch (Exception e) {
                LOG.error("Could not instantiate {}", resource.getName(), e);
            }
        }
    }
    // mount captcha resource only if captcha is enabled
    if (captchaEnabled) {
        mountResource("/api/captcha", new ResourceReference("captcha") {

            private static final long serialVersionUID = -128426276529456602L;

            @Override
            public IResource getResource() {
                return new CaptchaResource();
            }
        });
    }
}
Also used : Page(org.apache.wicket.Page) FileAlterationObserver(org.apache.commons.io.monitor.FileAlterationObserver) LoggerFactory(org.slf4j.LoggerFactory) HashMap(java.util.HashMap) BooleanUtils(org.apache.commons.lang3.BooleanUtils) ClassPathScanImplementationLookup(org.apache.syncope.client.enduser.init.ClassPathScanImplementationLookup) SyncopeClientFactoryBean(org.apache.syncope.client.lib.SyncopeClientFactoryBean) StringUtils(org.apache.commons.lang3.StringUtils) FileAlterationListenerAdaptor(org.apache.commons.io.monitor.FileAlterationListenerAdaptor) IResource(org.apache.wicket.request.resource.IResource) Map(java.util.Map) HomePage(org.apache.syncope.client.enduser.pages.HomePage) Response(org.apache.wicket.request.Response) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Request(org.apache.wicket.request.Request) ResourceReference(org.apache.wicket.request.resource.ResourceReference) SyncopeConstants(org.apache.syncope.common.lib.SyncopeConstants) Properties(java.util.Properties) Logger(org.slf4j.Logger) FileAlterationListener(org.apache.commons.io.monitor.FileAlterationListener) FileAlterationMonitor(org.apache.commons.io.monitor.FileAlterationMonitor) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) Args(org.apache.wicket.util.lang.Args) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) AbstractResource(org.apache.wicket.request.resource.AbstractResource) IOException(java.io.IOException) FileUtils(org.apache.commons.io.FileUtils) File(java.io.File) Serializable(java.io.Serializable) PropertyUtils(org.apache.syncope.common.lib.PropertyUtils) WebApplication(org.apache.wicket.protocol.http.WebApplication) CaptchaResource(org.apache.syncope.client.enduser.resources.CaptchaResource) Session(org.apache.wicket.Session) CustomAttributesInfo(org.apache.syncope.client.enduser.model.CustomAttributesInfo) Resource(org.apache.syncope.client.enduser.annotations.Resource) EnduserInitializer(org.apache.syncope.client.enduser.init.EnduserInitializer) InputStream(java.io.InputStream) FileAlterationMonitor(org.apache.commons.io.monitor.FileAlterationMonitor) AbstractResource(org.apache.wicket.request.resource.AbstractResource) CaptchaResource(org.apache.syncope.client.enduser.resources.CaptchaResource) Properties(java.util.Properties) FileAlterationObserver(org.apache.commons.io.monitor.FileAlterationObserver) ClassPathScanImplementationLookup(org.apache.syncope.client.enduser.init.ClassPathScanImplementationLookup) SyncopeClientFactoryBean(org.apache.syncope.client.lib.SyncopeClientFactoryBean) FileAlterationListener(org.apache.commons.io.monitor.FileAlterationListener) TypeReference(com.fasterxml.jackson.core.type.TypeReference) ResourceReference(org.apache.wicket.request.resource.ResourceReference) CustomAttributesInfo(org.apache.syncope.client.enduser.model.CustomAttributesInfo) InputStream(java.io.InputStream) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) IResource(org.apache.wicket.request.resource.IResource) AbstractResource(org.apache.wicket.request.resource.AbstractResource) CaptchaResource(org.apache.syncope.client.enduser.resources.CaptchaResource) Resource(org.apache.syncope.client.enduser.annotations.Resource) IOException(java.io.IOException) WicketRuntimeException(org.apache.wicket.WicketRuntimeException) IOException(java.io.IOException) FileAlterationListenerAdaptor(org.apache.commons.io.monitor.FileAlterationListenerAdaptor) File(java.io.File) IResource(org.apache.wicket.request.resource.IResource)

Aggregations

Map (java.util.Map)3 StringUtils (org.apache.commons.lang3.StringUtils)3 List (java.util.List)2 Manifest (android.Manifest)1 Activity (android.app.Activity)1 AlertDialog (android.app.AlertDialog)1 DownloadManager (android.app.DownloadManager)1 Request (android.app.DownloadManager.Request)1 ContentUris (android.content.ContentUris)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 PackageManager (android.content.pm.PackageManager)1 ResolveInfo (android.content.pm.ResolveInfo)1 ContentObserver (android.database.ContentObserver)1 Cursor (android.database.Cursor)1 Color (android.graphics.Color)1 Uri (android.net.Uri)1 AsyncTask (android.os.AsyncTask)1 Build (android.os.Build)1