Package org.apache.geronimo.gbean

Examples of org.apache.geronimo.gbean.AbstractName


        List<ConfigurationData> results = new ArrayList<ConfigurationData>();
        for (AbstractName storeName : stores) {
            try {
                List<ConfigurationInfo> infos = mgr.listConfigurations(storeName);
                for (ConfigurationInfo info : infos) {
                    AbstractName configuration = Configuration.getConfigurationAbstractName(info.getConfigID());
                    if (type == null || type.getValue() == info.getType().getValue()) {
                        J2EEDeployedObject module = getModuleForConfiguration(info.getConfigID());
                        results.add(new ConfigurationData(info.getConfigID(), configuration, null, info.getState(), info.getType(), module == null ? null : kernel.getAbstractNameFor(module)));
                    }
                    if (includeChildModules && info.getType().getValue() == ConfigurationModuleType.EAR.getValue() && info.getState().toInt() == State.RUNNING_INDEX) {
View Full Code Here


        Configuration config = manager.getConfiguration(configuration);
        if (config == null || !manager.isRunning(configuration)) {
            return null; // The configuration is not running, so we can't get its contents
        }
        ConfigurationModuleType type = config.getModuleType();
        AbstractName result;
        try {
            if (type.equals(ConfigurationModuleType.CAR)) {
                result = config.findGBean(new AbstractNameQuery(AppClientModule.class.getName()));
            } else if (type.equals(ConfigurationModuleType.EAR)) {
                result = config.findGBean(new AbstractNameQuery(J2EEApplication.class.getName()));
View Full Code Here

        Set set = kernel.listGBeans(new AbstractNameQuery(iface.getName()));
        Object[] result = (Object[]) Array.newInstance(iface, set.size());
        int index = 0;
        ProxyManager mgr = kernel.getProxyManager();
        for (Iterator it = set.iterator(); it.hasNext();) {
            AbstractName name = (AbstractName) it.next();
            result[index++] = mgr.createProxy(name, iface);
        }
        return result;
    }   
View Full Code Here

        return array;
    }

    private<T> T proxify(T t, Class<T> clazz) {
        if (!(t instanceof GeronimoManagedBean)) {
            AbstractName name = kernel.getAbstractNameFor(t);
            t = (T) kernel.getProxyManager().createProxy(name, clazz);
        }
        return t;
    }
View Full Code Here

            String mode = actionRequest.getParameter("mode");
            String brokerURI = actionRequest.getParameter("brokerURI");
            if(mode.equals("start")) {
                try {
                    //todo: this only goes into the "starting" state, doesn't make it to "running" -- what's up with that?
                    PortletManager.getManagedBean(actionRequest, new AbstractName(URI.create(brokerURI))).startRecursive();
                } catch (Exception e) {
                    throw new PortletException(e);
                }
            } else if(mode.equals("stop")) {
                try {
                    PortletManager.getManagedBean(actionRequest,  new AbstractName(URI.create(brokerURI))).stop();
                } catch (Exception e) {
                    throw new PortletException(e);
                }
            } else if(mode.equals("edit")) {
                //todo: is there anything to edit?
View Full Code Here

        JMSBroker[] brokers = (JMSBroker[]) manager.getContainers();
        List beans = new ArrayList();
        try {
            for (int i = 0; i < brokers.length; i++) {
                AbstractName abstractName = PortletManager.getNameFor(renderRequest, brokers[i]);
                String displayName = abstractName.getName().get("name").toString();
                beans.add(new BrokerWrapper(displayName, abstractName.toString(), brokers[i]));
            }
        } catch (Exception e) {
            throw new PortletException(e);
        }
        return beans;
View Full Code Here

        }
        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);
                            }
View Full Code Here

                //todo: lots of validation
                String protocol = actionRequest.getParameter("protocol");
                String host = actionRequest.getParameter("host");
                int port = Integer.parseInt(actionRequest.getParameter("port"));
                String name = actionRequest.getParameter("name");
                AbstractName brokerAbstractName = new AbstractName(URI.create(brokerURI));
                // Create and configure the connector
                JMSConnector connector = PortletManager.createJMSConnector(actionRequest, manager, brokerAbstractName, name, protocol, host, port);
                // Start the connector
                try {
                    ((GeronimoManagedBean)connector).startRecursive();
                } catch (Exception e) {
                    log.error("Unable to start connector", e); //todo: get into rendered page somehow?
                }
                actionResponse.setRenderParameter("mode", "list");
            } else if(mode.equals("save")) { // User just submitted the form to update a connector
                // Get submitted values
                //todo: lots of validation
                String host = actionRequest.getParameter("host");
                int port = Integer.parseInt(actionRequest.getParameter("port"));
                // Identify and update the connector
                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
                JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(actionRequest, connectorAbstractName);
                if(connector != null) {
                    connector.setHost(host);
                    connector.setPort(port);
                }
                actionResponse.setRenderParameter("mode", "list");
            } else if(mode.equals("start")) {
                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
                try {
                    PortletManager.getManagedBean(actionRequest, connectorAbstractName).startRecursive();
                } catch (Exception e) {
                    throw new PortletException(e);
                }
                actionResponse.setRenderParameter("mode", "list");
            } else if(mode.equals("stop")) {
                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
                try {
                    PortletManager.getManagedBean(actionRequest, connectorAbstractName).stop();
                } catch (Exception e) {
                    throw new PortletException(e);
                }
                actionResponse.setRenderParameter("mode", "list");
            } else if(mode.equals("edit")) {
                actionResponse.setRenderParameter("connectorURI", connectorURI);
                actionResponse.setRenderParameter("brokerURI", brokerURI);
                actionResponse.setRenderParameter("mode", "edit");
            } else if(mode.equals("delete")) {
                AbstractName connectorAbstractName = new AbstractName(URI.create(connectorURI));
                manager.removeConnector(connectorAbstractName);
                actionResponse.setRenderParameter("mode", "list");
            }
        } catch (Throwable e) {
            log.error("Unable to process portlet action", e);
View Full Code Here

            if(mode.equals("new")) {
                String brokerURI = renderRequest.getParameter("brokerURI");
                String protocol = renderRequest.getParameter("protocol");
                renderRequest.setAttribute("protocol", protocol);
                renderRequest.setAttribute("brokerURI", brokerURI);
                renderRequest.setAttribute("brokerName", new AbstractName(URI.create(brokerURI)).getName().get("name").toString());
                renderRequest.setAttribute("mode", "add");
                editView.include(renderRequest, renderResponse);
            } else if(mode.equals("edit")) {
                String brokerURI = renderRequest.getParameter("brokerURI");
                String connectorURI = renderRequest.getParameter("connectorURI");
                JMSConnector connector = (JMSConnector)PortletManager.getManagedBean(renderRequest, new AbstractName(URI.create(connectorURI)));
                if(connector == null) {
                    doList(renderRequest, manager, renderResponse);
                } else {
                    renderRequest.setAttribute("connectorURI", connectorURI);
                    renderRequest.setAttribute("brokerName", new AbstractName(URI.create(brokerURI)).getName().get("name").toString());
                    renderRequest.setAttribute("connectorName", new AbstractName(URI.create(connectorURI)).getName().get("name").toString());
                    renderRequest.setAttribute("protocol", connector.getProtocol());
                    renderRequest.setAttribute("port", new Integer(connector.getPort()));
                    renderRequest.setAttribute("host", connector.getHost());
                    renderRequest.setAttribute("mode", "save");
                    editView.include(renderRequest, renderResponse);
View Full Code Here

    private void doList(RenderRequest renderRequest, JMSManager manager, RenderResponse renderResponse) throws PortletException, IOException {
        List beans = new ArrayList();
        JMSBroker[] brokers = (JMSBroker[]) manager.getContainers();
        for (int i = 0; i < brokers.length; i++) {
            JMSBroker broker = brokers[i];
            AbstractName brokerAbstractName = PortletManager.getNameFor(renderRequest, broker);
            JMSConnector[] connectors = (JMSConnector[]) manager.getConnectorsForContainer(broker);
            for (int j = 0; j < connectors.length; j++) {
                JMSConnector connector = connectors[j];
                AbstractName connectorAbstractName = PortletManager.getNameFor(renderRequest,connector);
                String brokerName = brokerAbstractName.getName().get("name").toString();
                String connectorName = connectorAbstractName.getName().get("name").toString();
                ConnectorWrapper info = new ConnectorWrapper(brokerName, brokerAbstractName.toString(),
                                                         connectorName, connectorAbstractName.toString(),
                                                         connector);
                beans.add(info);
            }
        }
        renderRequest.setAttribute("brokers", getBrokerList(renderRequest, manager));
View Full Code Here

TOP

Related Classes of org.apache.geronimo.gbean.AbstractName

Copyright © 2018 www.massapicom. 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.