Examples of JSCommonMessage


Examples of org.apache.geronimo.console.message.JSCommonMessage

       
        if (numericProperties.contains(propertyKey)) {
            try {
                Integer.parseInt(propertyValue);
            } catch (NumberFormatException nfe) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.numeric", propertyKey), null);
            }
        } else if (STRICTPOOLING.equals(propertyKey)) {
            if (!propertyValue.equalsIgnoreCase(TRUE)
                    && !propertyValue.equalsIgnoreCase(FALSE)) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.boolean", propertyKey), null);
            }       
        } else {
            try {
                EjbHelper.class.getClassLoader().loadClass(propertyValue);
            } catch (ClassNotFoundException e) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.invalid", propertyKey), null);
            }
        }

        Properties props = null;
        Container container = containerSystem.getContainer(containerId);
        if (container.getContainerType() == ContainerType.MESSAGE_DRIVEN) {
            OpenEjbSystem openEjbSystem = null;
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    OpenEjbSystem.class.getName());
            Set<AbstractName> systemGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : systemGBeans) {
                openEjbSystem = kernel.getProxyManager()
                        .createProxy(absName, OpenEjbSystem.class);
                props = openEjbSystem.getProperties();
                if (props == null) {
                    props = new Properties();
                }
                props.put(containerId + "." + propertyKey, propertyValue);
                openEjbSystem.setProperties(props);
                getGBeanDataFromConfiguration(absName).setAttribute("properties", props);

            }
        } else {
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    EjbContainer.class.getName());
            Set<AbstractName> containerGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : containerGBeans) {
                try {
                    String id = (String) kernel.getAttribute(absName, "id");
                    if (containerId.equals(id)) {
                        GBeanData gData1  = kernel.getGBeanData(absName);
                        ManageableAttributeStore attributeStore = kernel.getGBean(ManageableAttributeStore.class);                       
                        GBeanData gData  = getGBeanDataFromConfiguration(absName);
                        for(String attributeName : gData.getAttributeNames()){
                            if(attributeName.equalsIgnoreCase(propertyKey)){
                                // Hack to make changed values reflect on configuration restart.
                                gData.setAttribute(attributeName, propertyValue);
                                Properties gbeanProps = (Properties)gData1.getAttribute("properties");
                                gbeanProps.setProperty(propertyKey, propertyValue);
                                GAttributeInfo gAttributeInfo = gData.getGBeanInfo().getAttribute(attributeName);
                                attributeStore.setValue(absName.getArtifact(), absName, gAttributeInfo, propertyValue, Thread.currentThread().getContextClassLoader());
                            }
                        }
                    }
                } catch (GBeanNotFoundException e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                } catch (NoSuchAttributeException e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                } catch (Exception e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                }
            }
        }
        return new JSCommonMessage(CommonMessage.Type.Warn, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.restart"), null);
    }
View Full Code Here

Examples of org.apache.geronimo.console.message.JSCommonMessage

            if (ACCESSTIMEOUT.equals(propertyKey) || TIMEOUT.equals(propertyKey)) {
                try {
                    attributeValue = Long.parseLong(propertyValue);
                } catch (NumberFormatException nfe) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.numeric", propertyKey), null);
                }
            } else if (STRICTPOOLING.equals(propertyKey)) {
                if (!propertyValue.equalsIgnoreCase(TRUE)
                        && !propertyValue.equalsIgnoreCase(FALSE)) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.boolean", propertyKey), null);
                }
                attributeValue = Boolean.parseBoolean(propertyValue);
            } else {
                try {
                    attributeValue = Integer.parseInt(propertyValue);
                } catch (NumberFormatException nfe) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.numeric", propertyKey), null);
                }
            }

            try {
                kernel.setAttribute(gbean, attributeName, attributeValue);
            } catch (GBeanNotFoundException e) {
                return new JSCommonMessage(CommonMessage.Type.Error,
                        getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
            } catch (NoSuchAttributeException e) {
                return new JSCommonMessage(CommonMessage.Type.Error,
                        getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
            } catch (Exception e) {
                return new JSCommonMessage(CommonMessage.Type.Error,
                        getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
            }
           
            return new JSCommonMessage(CommonMessage.Type.Warn,
                    getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.restart"), null);
        }

        return new JSCommonMessage(CommonMessage.Type.Error,
                getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
    }
View Full Code Here

Examples of org.apache.geronimo.console.message.JSCommonMessage

        if (numericProperties.contains(propertyKey)) {
            try {
                Integer.parseInt(propertyValue);
            } catch (NumberFormatException nfe) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.numeric", propertyKey), null);
            }
        } else if (STRICTPOOLING.equals(propertyKey)) {
            if (!propertyValue.equalsIgnoreCase(TRUE)
                    && !propertyValue.equalsIgnoreCase(FALSE)) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.boolean", propertyKey), null);
            }
        } else {
            try {
                EjbHelper.class.getClassLoader().loadClass(propertyValue);
            } catch (ClassNotFoundException e) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.invalid", propertyKey), null);
            }
        }

        Properties props = null;
        Container container = containerSystem.getContainer(containerId);
        if (container.getContainerType() == ContainerType.MESSAGE_DRIVEN) {
            OpenEjbSystem openEjbSystem = null;
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    OpenEjbSystem.class.getName());
            Set<AbstractName> systemGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : systemGBeans) {
                openEjbSystem = kernel.getProxyManager()
                        .createProxy(absName, OpenEjbSystem.class);
                props = openEjbSystem.getProperties();
                if (props == null) {
                    props = new Properties();
                }
                props.put(containerId + "." + propertyKey, propertyValue);
                openEjbSystem.setProperties(props);
                getGBeanDataFromConfiguration(absName).setAttribute("properties", props);

            }
        } else {
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    EjbContainer.class.getName());
            Set<AbstractName> containerGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : containerGBeans) {
                try {
                    String id = (String) kernel.getAttribute(absName, "id");
                    if (containerId.equals(id)) {
                        GBeanData gData1  = kernel.getGBeanData(absName);
                        ManageableAttributeStore attributeStore = kernel.getGBean(ManageableAttributeStore.class);
                        GBeanData gData  = getGBeanDataFromConfiguration(absName);
                        for(String attributeName : gData.getAttributeNames()){
                            if(attributeName.equalsIgnoreCase(propertyKey)){
                                // Hack to make changed values reflect on configuration restart.
                                gData.setAttribute(attributeName, propertyValue);
                                Properties gbeanProps = (Properties)gData1.getAttribute("properties");
                                gbeanProps.setProperty(propertyKey, propertyValue);
                                GAttributeInfo gAttributeInfo = gData.getGBeanInfo().getAttribute(attributeName);
// TODO:  This needs to be solved and re-enabled.
//                                 attributeStore.setValue(absName.getArtifact(), absName, gAttributeInfo, propertyValue, Thread.currentThread().getContextClassLoader());
                            }
                        }
                    }
                } catch (GBeanNotFoundException e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                } catch (NoSuchAttributeException e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                } catch (Exception e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                }
            }
        }
        return new JSCommonMessage(CommonMessage.Type.Warn, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.restart"), null);
    }
View Full Code Here

Examples of org.apache.geronimo.console.message.JSCommonMessage

       
        if (numericProperties.contains(propertyKey)) {
            try {
                Integer.parseInt(propertyValue);
            } catch (NumberFormatException nfe) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.numeric", propertyKey), null);
            }
        } else if (STRICTPOOLING.equals(propertyKey)) {
            if (!propertyValue.equalsIgnoreCase(TRUE)
                    && !propertyValue.equalsIgnoreCase(FALSE)) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.boolean", propertyKey), null);
            }       
        } else {
            try {
                EjbHelper.class.getClassLoader().loadClass(propertyValue);
            } catch (ClassNotFoundException e) {
                return new JSCommonMessage(CommonMessage.Type.Error, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.invalid", propertyKey), null);
            }
        }

        Properties props = null;
        Container container = containerSystem.getContainer(containerId);
        if (container.getContainerType() == ContainerType.MESSAGE_DRIVEN) {
            OpenEjbSystem openEjbSystem = null;
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    OpenEjbSystem.class.getName());
            Set<AbstractName> systemGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : systemGBeans) {
                openEjbSystem = kernel.getProxyManager()
                        .createProxy(absName, OpenEjbSystem.class);
                props = openEjbSystem.getProperties();
                if (props == null) {
                    props = new Properties();
                }
                props.put(containerId + "." + propertyKey, propertyValue);
                openEjbSystem.setProperties(props);
                getGBeanDataFromConfiguration(absName).setAttribute("properties", props);

            }
        } else {
            AbstractNameQuery absQuery = new AbstractNameQuery(
                    EjbContainer.class.getName());
            Set<AbstractName> containerGBeans = kernel.listGBeans(absQuery);
            for (AbstractName absName : containerGBeans) {
                try {
                    String id = (String) kernel.getAttribute(absName, "id");
                    if (containerId.equals(id)) {
                        GBeanData gData1  = kernel.getGBeanData(absName);
                        ManageableAttributeStore attributeStore = kernel.getGBean(ManageableAttributeStore.class);                       
                        GBeanData gData  = getGBeanDataFromConfiguration(absName);
                        for(String attributeName : gData.getAttributeNames()){
                            if(attributeName.equalsIgnoreCase(propertyKey)){
                                // Hack to make changed values reflect on configuration restart.
                                gData.setAttribute(attributeName, propertyValue);
                                Properties gbeanProps = (Properties)gData1.getAttribute("properties");
                                gbeanProps.setProperty(propertyKey, propertyValue);
                                GAttributeInfo gAttributeInfo = gData.getGBeanInfo().getAttribute(attributeName);
                                attributeStore.setValue(absName.getArtifact(), absName, gAttributeInfo, propertyValue, Thread.currentThread().getContextClassLoader());
                            }
                        }
                    }
                } catch (GBeanNotFoundException e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                } catch (NoSuchAttributeException e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                } catch (Exception e) {
                    return new JSCommonMessage(CommonMessage.Type.Error,
                            getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.unchanged", propertyKey), null);
                }
            }
        }
        return new JSCommonMessage(CommonMessage.Type.Warn, getLocalizedString(request, BUNDLE_NAME, "portlet.openejb.view.restart"), null);
    }
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.