Examples of WebManager


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

            renderRequest.setAttribute("selectedContainer", chosen);
        }
        WebAccessLog chosenLog = null;
        if(managers != null) {
            for (int i = 0; i < managers.length; i++) {
                WebManager manager = managers[i];
                AbstractName managerName = PortletManager.getNameFor(renderRequest, manager);
                WebContainer[] containers = (WebContainer[]) manager.getContainers();
                if (containers != null) {
                    for (int j = 0; j < containers.length; j++) {
                        WebContainer container = containers[j];
                        AbstractName containerName = PortletManager.getNameFor(renderRequest, container);
                        String combined = managerName+"%"+containerName;
                        if(containers.length == 1) {
                            products.put(manager.getProductName(), combined);
                        } else {
                            products.put(manager.getProductName()+" ("+containerName.getName().get(NameFactory.J2EE_NAME)+")", combined);
                        }
                        if(chosenLog == null) { // will pick the correct match, or the first if no selection is specified
                            if(chosen == null || chosen.equals(combined)) {
                                chosenLog = PortletManager.getWebAccessLog(renderRequest, managerName, containerName);
                            }
                        }
                    }
                } else {
                    log.error("No web containers found for manager "+manager.getProductName());
                }
            }
        } else {
            log.error("No web managers found!");
        }
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
            }
            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));
            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)) {
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

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

    private void doList(RenderRequest renderRequest, RenderResponse renderResponse) throws PortletException, IOException {
        WebManager[] managers = PortletManager.getWebManagers(renderRequest);
        List<ContainerInfo> all = new ArrayList<ContainerInfo>();
        for (int i = 0; i < managers.length; i++) {
            WebManager manager = managers[i];
            AbstractName webManagerName = PortletManager.getNameFor(renderRequest, manager);
           
            WebContainer[] containers = (WebContainer[]) manager.getContainers();
            for (int j = 0; j < containers.length; j++) {
                List<ConnectorInfo> beans = new ArrayList<ConnectorInfo>();
                WebContainer container = containers[j];
                AbstractName containerName = PortletManager.getNameFor(renderRequest, container);
                String id;
                if(containers.length == 1) {
                    id = manager.getProductName();
                } else {
                    id = manager.getProductName() + " (" + containerName.getName().get(NameFactory.J2EE_NAME) + ")";
                }
                ContainerInfo result = new ContainerInfo(id, webManagerName.toString(), containerName.toString());

                for (NetworkConnector connector : manager.getConnectorsForContainer(container)) {
                    ConnectorInfo info = new ConnectorInfo();
                    AbstractName connectorName = PortletManager.getNameFor(renderRequest, connector);
                    info.setConnectorURI(connectorName.toString());
                    info.setDescription(PortletManager.getGBeanDescription(renderRequest, connectorName));
                    info.setUniqueName((String)connectorName.getName().get(NameFactory.J2EE_NAME));
                    info.setState(((GeronimoManagedBean)connector).getState());
                    info.setPort(connector.getPort());
                    try {
                        info.setProtocol(connector.getProtocol());
                    } catch (IllegalStateException e) {
                        info.setProtocol("unknown");
                    }
                    beans.add(info);
                }
                result.setConnectors(beans);
                result.setConnectorTypes(manager.getConnectorTypes());
                all.add(result);
            }
        }
        renderRequest.setAttribute("containers", all);
        renderRequest.setAttribute("serverPort", new Integer(renderRequest.getServerPort()));
View Full Code Here

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
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.