Package org.apache.geronimo.gbean

Examples of org.apache.geronimo.gbean.GAttributeInfo


        // manageable
        this.manageable = manageable;

        // create an attribute info for this gbean
        attributeInfo = new GAttributeInfo(this.name,
                this.type.getName(),
                this.persistent,
                this.manageable,
                this.readable,
                this.writable,
View Full Code Here


        try {
            GBeanInfo gbeanInfo = kernel.getGBeanInfo(gbeanName);
            Set attributes = gbeanInfo.getAttributes();
            Map values = new HashMap(attributes.size());
            for (Iterator i = attributes.iterator(); i.hasNext();) {
                GAttributeInfo attribute = (GAttributeInfo) i.next();
                String gname = attribute.getName();
                if (HIDDEN_ATTRIBUTES.contains(gname)) {
                    continue;
                }
                Object value = kernel.getAttribute(gbeanName, gname);
                values.put(gname, value);
View Full Code Here

            // fail("InvalidConfigurationException expected");
        } catch (InvalidConfigurationException expected) {
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo(attributeName, String.class.getName(), false, false, true, false, null, null);
            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo);
            assertTrue(attribute.isReadable());
            assertFalse(attribute.isWritable());
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo(persistentPrimitiveAttributeName, int.class.getName(), false, false, false, true, null, null);
            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo);
            assertFalse(attribute.isReadable());
            assertTrue(attribute.isWritable());
        }

        {
            // the attribute name and getter name are different, yet both
            // exist.
            // getYetAnotherFinalInt doesn't exist
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, "getFinalInt", null);
            GBeanAttribute attribute = new GBeanAttribute(gbeanInstance, attributeInfo);
            assertNotNull(attribute);
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setCharAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setBooleanAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setByteAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setShortAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setLongAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setFloatAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setDoubleAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Expected InvalidConfigurationException due to invalid setter parameter type");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, "getVoidGetterOfFinalInt", null);
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Getter method not found on target; InvalidConfigurationException expected");
            } catch (InvalidConfigurationException expected) {
            }
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setThatDoesntExist");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo);
                fail("Setter method not found on target; InvalidConfigurationException expected");
            } catch (InvalidConfigurationException expected) {
            }
View Full Code Here

            public Object invoke(Object target, Object[] arguments) throws Exception {
                throw new UnsupportedOperationException("Throws exception to rise test coverage");
            }
        };

        attributeInfo = new GAttributeInfo(attributeName, String.class.getName(), false, false, "getName", "setName");
        persistentPrimitiveAttributeInfo = new GAttributeInfo(persistentPrimitiveAttributeName, int.class.getName(), true, false, "getMutableInt", "setMutableInt");
    }
View Full Code Here

        try {
            AbstractName abstractName = new AbstractName(URI.create(abstractNameString));
            GBeanInfo gBeanInfo = kernel.getGBeanInfo(abstractName);
            Set<GAttributeInfo> attrs = gBeanInfo.getAttributes();
            for (Iterator<GAttributeInfo> i = attrs.iterator(); i.hasNext();) {
                GAttributeInfo gAttrInfo = i.next();
                String attrName = gAttrInfo.getName();
                if (!GBEANINFO_ATTRIB.equals(attrName)) {   // Don't include the 'GBeanInfo' attributes
                    Map<String, String> attrInfoMap = getAttrInfoAsMap(abstractName, gAttrInfo);
                    attributes.put(attrName, attrInfoMap);
                }
            }
View Full Code Here

    private static void setGBeanBaseUrl(GBeanData gbeanData, URL baseUrl) {
        GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
        Set attributes = gbeanInfo.getAttributes();
        for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
            GAttributeInfo attribute = (GAttributeInfo) iterator.next();
            if (attribute.getName().equals("configurationBaseUrl") && attribute.getType().equals("java.net.URL")) {
                gbeanData.setAttribute("configurationBaseUrl", baseUrl);
                return;
            }
        }
    }
View Full Code Here

            log.debug("Configuration cannot load manageable attributes; no manageable store present");
            return;
        }
        List list = data.getGBeanInfo().getManageableAttributes();
        for (int i = 0; i < list.size(); i++) {
            GAttributeInfo info = (GAttributeInfo) list.get(i);
            Object value = manageableStore.getValue(id.toString(), data.getName(), info);
            if(value != null) {
                data.setAttribute(info.getName(), value);
            }
        }
    }
View Full Code Here

        // not manageable
        this.manageable = false;

        // create an attribute info for this gbean
        if (attribute != null) {
            GAttributeInfo attributeInfo = attribute.getAttributeInfo();
            this.attributeInfo = new GAttributeInfo(this.name,
                    this.type.getName(),
                    this.persistent,
                    this.manageable,
                    this.readable,
                    this.writable,
                    attributeInfo.getGetterName(),
                    attributeInfo.getSetterName());
        } else {
            this.attributeInfo = new GAttributeInfo(this.name,
                    this.type.getName(),
                    this.persistent,
                    this.manageable,
                    this.readable,
                    this.writable,
View Full Code Here

        // manageable
        this.manageable = manageable;

        // create an attribute info for this gbean
        attributeInfo = new GAttributeInfo(this.name,
                this.type.getName(),
                this.persistent,
                this.manageable,
                this.readable,
                this.writable,
View Full Code Here

            text = text.trim(); // avoid formatting errors due to extra whitespace in XML configuration file
        }
        try {
            // @todo we should not need all of common just for this
            if (type == null) {
                GAttributeInfo attribute = gbean.getGBeanInfo().getAttribute(name);
                if (attribute == null) {
                    throw new DeploymentException("Unknown attribute " + name + " on " + gbean.getName());
                }
                type = attribute.getType();
            }

            PropertyEditor editor = PropertyEditors.findEditor(type, classLoader);
            if (editor == null) {
                throw new DeploymentException("Unable to find PropertyEditor for " + type);
View Full Code Here

TOP

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

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.