Examples of WebManager


Examples of org.apache.geronimo.management.geronimo.WebManager

//    }
//

    public static WebAccessLog getWebAccessLog(PortletRequest request, AbstractName managerName, AbstractName containerName) {
        ManagementHelper helper = getManagementHelper(request);
        WebManager manager = (WebManager) helper.getObject(managerName);
        return manager.getAccessLog((WebContainer) helper.getObject(containerName));
    }
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

        return (WebContainer) helper.getObject(containerName);
    }

    public static NetworkConnector[] getNetworkConnectors(PortletRequest request, AbstractName managerName) {
        ManagementHelper helper = getManagementHelper(request);
        WebManager manager = (WebManager) helper.getObject(managerName);
        return manager.getConnectors();
    }
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

        return manager.getConnectors();
    }

    public static NetworkConnector[] getNetworkConnectors(PortletRequest request, AbstractName managerName, String protocol) {
        ManagementHelper helper = getManagementHelper(request);
        WebManager manager = (WebManager) helper.getObject(managerName);
        return manager.getConnectors(protocol);
    }
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

        return (NetworkConnector) helper.getObject(connectorName);
    }

    public static NetworkConnector[] getNetworkConnectorsForContainer(PortletRequest request, AbstractName managerName, AbstractName containerName, String protocol) {
        ManagementHelper helper = getManagementHelper(request);
        WebManager manager = (WebManager) helper.getObject(managerName);
        return manager.getConnectorsForContainer(containerName, protocol);
    }
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

    public void processAction(ActionRequest actionRequest,
                              ActionResponse actionResponse) throws PortletException, IOException {
        try {
            WebManager[] managers = PortletManager.getCurrentServer(actionRequest).getWebManagers();
            if (managers != null) {
                WebManager manager = managers[0]//todo: handle multiple
                WebContainer[] containers = (WebContainer[]) manager.getContainers();
                if (containers != null) {
                    WebContainer container = containers[0]//todo: handle multiple
                    String server = getWebServerType(container.getClass());
                    if (actionRequest.getParameter("stats") != null) {
                        Boolean stats = actionRequest.getParameter("stats").equals("true") ? Boolean.TRUE : Boolean.FALSE;
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

            return;
        }
        try {
            WebManager[] managers = PortletManager.getCurrentServer(renderRequest).getWebManagers();
            if (managers != null) {
                WebManager manager = managers[0]//todo: handle multiple
                WebContainer[] containers = (WebContainer[]) manager.getContainers();
                if (containers != null) {
                    WebContainer container = containers[0]//todo: handle multiple
                    if(container.isStatisticsProvider()) {
                        boolean populateStats = false;
                        renderRequest.setAttribute("statsSupported", Boolean.TRUE)// indicate that statistics are supported for this container
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

    public String actionBeforeView(ActionRequest request, ActionResponse response, MultiPageModel model) throws PortletException, IOException {
        WebManager[] managers = PortletManager.getWebManagers(request);
        // See if any AJP listeners are defined
        for (int i = 0; i < managers.length; i++) {
            WebManager manager = managers[i];
            NetworkConnector[] connectors = manager.getConnectors(WebManager.PROTOCOL_AJP);
            if(connectors.length > 0 && connectors[0]!=null) {
                log.warn("Found AJP listener on port "+connectors[0].getPort());
                return BASIC_CONFIG_MODE+BEFORE_ACTION;
            }
        }
        // Find an unused port
        int port = 8009;
        outer:
        while(true) {
            for (int i = 0; i < managers.length; i++) {
                WebManager manager = managers[i];
                NetworkConnector[] cons = manager.getConnectors();
                for (int j = 0; j < cons.length; j++) {
                    NetworkConnector con = cons[j];
                    if(con.getPort() == port) {
                        port += 10;
                        continue outer;
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

        if(model.getAddAjpPort() == null) {
            return getMode()+BEFORE_ACTION; //todo: some sort of error message
        }
        WebManager[] managers = PortletManager.getWebManagers(request);
        for (int i = 0; i < managers.length; i++) {
            WebManager manager = managers[i];
            NetworkConnector[] cons =  manager.getConnectors();
            for (int j = 0; j < cons.length; j++) {
                NetworkConnector con = cons[j];
                if(con.getPort() == model.getAddAjpPort().intValue()) {
                    return getMode()+BEFORE_ACTION; //todo: some sort of error message
                }
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

            actionResponse.setRenderParameter(PARM_MODE, "new");
            String connectorType = actionRequest.getParameter(PARM_CONNECTOR_TYPE);
            actionResponse.setRenderParameter(PARM_CONNECTOR_TYPE, connectorType);
        } else if(mode.equals("add")) { // User just submitted the form to add a new connector
            // Create and configure the connector
            WebManager manager = PortletManager.getWebManager(actionRequest, new AbstractName(URI.create(managerURI)));
            ConnectorType connectorType = new ConnectorType(actionRequest.getParameter(PARM_CONNECTOR_TYPE));
           
            String uniqueName = actionRequest.getParameter(PARM_DISPLAY_NAME);
            actionResponse.setRenderParameter(PARM_DISPLAY_NAME, uniqueName);
            // set the connector attributes from the form post
            List<ConnectorAttribute> connectorAttributes = manager.getConnectorAttributes(connectorType);
            for (ConnectorAttribute attribute : connectorAttributes) {
                String name = attribute.getAttributeName();
                String value = actionRequest.getParameter(name);
               
                // handle booelan type special
                if (attribute.getAttributeClass().equals(Boolean.class)) {
                    // browser sends value of checked checkbox as "on" or "checked"
                    if ("on".equalsIgnoreCase(value) || "checked".equalsIgnoreCase(value)) {
                        value=Boolean.toString(true);
                    } else {
                        value=Boolean.toString(false);
                    }
                }
                // set the string form of the attribute's value as submitted by the browser
                if (value == null || value.trim().length()<1) {
                    // special case for KeystoreManager gbean
                    if ("trustStore".equals(attribute.getAttributeName())) {
                        attribute.setValue(null);
                    }
                } else {
                    attribute.setStringValue(value.trim());
                }
            }
            // create the connector gbean based on the configuration data
            AbstractName newConnectorName = manager.getConnectorConfiguration(connectorType, connectorAttributes, webContainer, uniqueName);
           
            // set the keystore properties if its a secure connector
            setKeystoreProperties(actionRequest, newConnectorName);
           
            // Start the connector
            try {
                GeronimoManagedBean managedBean = PortletManager.getManagedBean(actionRequest, newConnectorName);
                managedBean.startRecursive();
            } catch (Exception e) {
                log.error("Unable to start connector", e); //TODO: get into rendered page
            }
           
            try {
                manager.updateConnectorConfig(newConnectorName);
            } catch (Exception e) {
                log.error("Unable to update connector in server.xml", e); //TODO: get into rendered page
            }
            actionResponse.setRenderParameter(PARM_MODE, "list");
        } else if(mode.equals("save")) { // User just submitted the form to update a connector
            // Get submitted values
            //todo: lots of validation
            String connectorURI = actionRequest.getParameter(PARM_CONNECTOR_URI);
            // Identify and update the connector
            AbstractName connectorName = new AbstractName(URI.create(connectorURI));
            GBeanData connectorGBeanData=null;
            try {
                connectorGBeanData=PortletManager.getKernel().getGBeanData(connectorName);
            } catch (Exception e) {
                log.error("Unable to get connectorGBeanData by abstractName:"+connectorName.toURI(), e);
            }
           
            NetworkConnector connector = PortletManager.getNetworkConnector(actionRequest, connectorName);
            if(connector != null) {
                WebManager manager = PortletManager.getWebManager(actionRequest, new AbstractName(URI.create(managerURI)));
                ConnectorType connectorType = manager.getConnectorType(connectorName);
               
                // set the connector attributes from the form post
                for (ConnectorAttribute attribute : manager.getConnectorAttributes(connectorType)) {
                    String name = attribute.getAttributeName();
                    String value = actionRequest.getParameter(name);
                   
                    // handle booelan type special
                    if (attribute.getAttributeClass().equals(Boolean.class)) {
                        // browser sends value of checked checkbox as "on" or "checked"
                        if ("on".equalsIgnoreCase(value) || "checked".equalsIgnoreCase(value)) {
                            value=Boolean.toString(true);
                        } else {
                            value=Boolean.toString(false);
                        }
                    }
                    // set the string form of the attribute's value as submitted by the browser
                    if (value == null || value.trim().length()<1) {
                        // special case for KeystoreManager gbean
                        if ("trustStore".equals(attribute.getAttributeName())) {
                           
                            connectorGBeanData.setAttribute(name, null);
                        }
                    } else {
                        // set the string value on the ConnectorAttribute so
                        // it can handle type conversion via getValue()
                        try {
                            attribute.setStringValue(value);
                            connectorGBeanData.setAttribute(name, attribute.getValue());
                        } catch (Exception e) {
                            log.error("Unable to set property " + attribute.getAttributeName(), e);
                        }
                    }
                }
               
                // set the keystore properties if its a secure connector
                setKeystoreProperties(actionRequest, connectorName);
               
                try {
                    Kernel kernel=PortletManager.getKernel();
                    ClassLoader oldCL=connector.getClass().getClassLoader();
                    kernel.stopGBean(connectorName);
                    kernel.unloadGBean(connectorName);
                   
                   
                    kernel.loadGBean(connectorGBeanData, oldCL);
                    kernel.startGBean(connectorName);
                 
                } catch (Exception e) {
                    log.error("Unable to reload updated connector:"+connectorName.toURI(), e);
                }
               
               
                try {
                    manager.updateConnectorConfig(connectorName);
                } catch (Exception e) {
                    log.error("Unable to update connector in server.xml", e); //TODO: get into rendered page
                }
            }
            actionResponse.setRenderParameter(PARM_MODE, "list");
View Full Code Here

Examples of org.apache.geronimo.management.geronimo.WebManager

            String server = getWebServerType(container.getClass());
            renderRequest.setAttribute(PARM_SERVER, server);

            if(mode.equals("new")) {
                String connectorType = renderRequest.getParameter(PARM_CONNECTOR_TYPE);
                WebManager webManager = PortletManager.getWebManager(renderRequest, new AbstractName(URI.create(managerURI)));
                ConnectorType type = new ConnectorType(connectorType);
                List<ConnectorAttribute> connectorAttributes = webManager.getConnectorAttributes(type);
                sortConnectorAttributes(connectorAttributes);
                renderRequest.setAttribute(PARM_CONNECTOR_ATTRIBUTES, connectorAttributes);
                renderRequest.setAttribute(PARM_CONNECTOR_TYPE, connectorType);
                renderRequest.setAttribute(PARM_MODE, "add");
                populateEnumAttributes(renderRequest);
                editConnectorView.include(renderRequest, renderResponse);
            } else if(mode.equals("edit")) {
                String connectorURI = renderRequest.getParameter(PARM_CONNECTOR_URI);
                NetworkConnector connector = PortletManager.getNetworkConnector(renderRequest, new AbstractName(URI.create(connectorURI)));
                if(connector == null) {
                    doList(renderRequest, renderResponse);
                } else {
                    AbstractName connectorName = new AbstractName(URI.create(connectorURI));
                    String uniqueName = connectorName.getName().get("name").toString();
                    renderRequest.setAttribute(PARM_DISPLAY_NAME, uniqueName);
                    WebManager webManager = PortletManager.getWebManager(renderRequest, new AbstractName(URI.create(managerURI)));
                    ConnectorType connectorType = webManager.getConnectorType(connectorName);
                    List<ConnectorAttribute> connectorAttributes = webManager.getConnectorAttributes(connectorType);
                    sortConnectorAttributes(connectorAttributes);
                   
                    // populate the connector attributes from the connector
                    for (ConnectorAttribute attribute : connectorAttributes) {
                        try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.