Example usage for com.liferay.portal.kernel.util PropsKeys SOURCE_FORGE_MIRRORS

List of usage examples for com.liferay.portal.kernel.util PropsKeys SOURCE_FORGE_MIRRORS

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PropsKeys SOURCE_FORGE_MIRRORS.

Prototype

String SOURCE_FORGE_MIRRORS

To view the source code for com.liferay.portal.kernel.util PropsKeys SOURCE_FORGE_MIRRORS.

Click Source Link

Usage

From source file:com.liferay.marketplace.app.manager.web.internal.portlet.MarketplaceAppManagerPortlet.java

License:Open Source License

protected void doInstallSourceForgeApp(String path, ActionRequest actionRequest) throws Exception {

    String[] sourceForgeMirrors = PropsUtil.getArray(PropsKeys.SOURCE_FORGE_MIRRORS);

    for (int i = 0; i < sourceForgeMirrors.length; i++) {
        try {/*from   w w w.  j  av a  2 s  .  com*/
            String url = sourceForgeMirrors[i] + path;

            boolean failOnError = false;

            if ((i + 1) == sourceForgeMirrors.length) {
                failOnError = true;
            }

            int responseCode = doInstallRemoteApp(url, actionRequest, failOnError);

            if (responseCode == HttpServletResponse.SC_OK) {
                return;
            }
        } catch (MalformedURLException murle) {
            SessionErrors.add(actionRequest, "invalidUrl", murle);
        }
    }
}

From source file:com.liferay.marketplace.appmanager.portlet.AppManagerPortlet.java

License:Open Source License

protected void doInstallSourceForgeApp(String path, UploadPortletRequest uploadPortletRequest,
        ActionRequest actionRequest) throws Exception {

    String[] sourceForgeMirrors = PropsUtil.getArray(PropsKeys.SOURCE_FORGE_MIRRORS);

    for (int i = 0; i < sourceForgeMirrors.length; i++) {
        try {//w ww .  java2  s  .c o  m
            String url = sourceForgeMirrors[i] + path;

            boolean failOnError = false;

            if ((i + 1) == sourceForgeMirrors.length) {
                failOnError = true;
            }

            int responseCode = doInstallRemoteApp(url, uploadPortletRequest, actionRequest, failOnError);

            if (responseCode == HttpServletResponse.SC_OK) {
                return;
            }
        } catch (MalformedURLException murle) {
            SessionErrors.add(actionRequest, "invalidUrl", murle);
        }
    }
}

From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java

License:Open Source License

protected String[] getSourceForgeMirrors() {
    return PropsUtil.getArray(PropsKeys.SOURCE_FORGE_MIRRORS);
}