All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web.carbonapps.process_faulty_carbon_apps.jsp Maven / Gradle / Ivy


<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
<%@ page import="org.wso2.carbon.CarbonConstants" %>
<%@ page import="org.wso2.carbon.application.mgt.ui.ApplicationAdminClient" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
<%@ page import="org.wso2.carbon.ui.util.CharacterEncoder" %>
<%
    String pageAction = CharacterEncoder.getSafeText(request.getParameter("action"));
    String pageNumber = CharacterEncoder.getSafeText(request.getParameter("pageNumber"));
    int pageNumberInt = 0;
    if (pageNumber != null) {
        pageNumberInt = Integer.parseInt(pageNumber);
    }
    String[] faultyCarbonAppFileNames = request.getParameterValues("carbonAppFileName");
    String processAllServiceGroups = CharacterEncoder.getSafeText(request.getParameter("processAllCarbonApps"));
%>

<%
    String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
    ConfigurationContext configContext =
            (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);

    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
    ApplicationAdminClient client;
    try {
        client = new ApplicationAdminClient(cookie, backendServerURL, configContext, request.getLocale());
    } catch (Exception e) {
        CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
        session.setAttribute(CarbonUIMessage.ID, uiMsg);
%>

<%
        return;
    }

    try {
        if (pageAction.equals("delete")) {
            if (processAllServiceGroups != null) {
                String[] faultyList = client.getAllFaultyApps();
                client.deleteFaultyApp(faultyList);
            } else {
                client.deleteFaultyApp(faultyCarbonAppFileNames);
            }
        } else if (pageAction.equals("redeploy")) {
            if (processAllServiceGroups != null) {
                String[] faultyList = client.getAllFaultyApps();
                client.redeployApplications(faultyList);
            } else {
                client.redeployApplications(faultyCarbonAppFileNames);
            }
        } else {
            throw new Exception("Invalid page action : " + pageAction);
        }
%>

<%
    } catch (Exception e) {
        CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
        session.setAttribute(CarbonUIMessage.ID, uiMsg);
%>

<%
        return;
    }
%>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy