Examples of GAttributeInfo


Examples of org.apache.geronimo.gbean.GAttributeInfo

        String namespace = xmlObject.getDomNode().getNamespaceURI();
        XmlAttributeBuilder builder = (XmlAttributeBuilder) xmlAttributeBuilderMap.get(namespace);
        if (builder == null) {
            throw new DeploymentException("No attribute builder deployed for namespace: " + namespace);
        }
        GAttributeInfo attribute = gbean.getGBeanInfo().getAttribute(name);
        if (attribute == null) {
            throw new DeploymentException("Unknown attribute " + name + " on " + gbean.getAbstractName());
        }
        String type = attribute.getType();
        Object value = builder.getValue(xmlObject, type, classLoader);
        gbean.setAttribute(name, value);
    }
View Full Code Here

Examples of org.apache.geronimo.gbean.GAttributeInfo

                if (list == null) {
                    list = new ArrayList(3);
                    beanInfos.put(info, list);
                    Set atts = info.getAttributes();
                    for (Iterator it2 = atts.iterator(); it2.hasNext();) {
                        GAttributeInfo att = (GAttributeInfo) it2.next();
                        if (att.getType().equals("java.net.InetSocketAddress")) {
                            list.add(att);
                        }
                    }
                }
                for (int i = 0; i < list.size(); i++) {
                    GAttributeInfo att = (GAttributeInfo) list.get(i);
                    try {
                        InetSocketAddress addr = (InetSocketAddress) kernel.getAttribute(name, att.getName());
                        if (addr == null) {
                            log.debug("No value for GBean " + name + " attribute " + att.getName());
                            continue;
                        } else if (addr.getAddress() == null || addr.getAddress().getHostAddress() == null) {
                            log.debug("Null address or host for GBean " + name + " " + att.getName() + ": " + addr.getAddress());
                        }
                        String attName = info.getName();
                        if (list.size() > 1) {
                            attName += " " + decamelize(att.getName());
                        } else if (info.getAttribute("name") != null) {
                            attName += " " + kernel.getAttribute(name, "name");
                        }
                        ports.add(new AddressHolder(attName, addr));
                    } catch (IllegalStateException e) {
View Full Code Here

Examples of org.apache.geronimo.gbean.GAttributeInfo

        // set attributes
        for (Object o : gbeanData.getAttributes().entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            String attributeName = (String) entry.getKey();
            GAttributeInfo attributeInfo = gbeanInfo.getAttribute(attributeName);
            if (attributeInfo == null) {
                throw new InvalidAttributeException("No attribute: " + attributeName + " for gbean: " + gbeanData.getAbstractName());
            }
            // TODO: shouldn't we only save manageable attributes here?
            Object attributeValue = entry.getValue();
            setAttribute(attributeInfo, attributeValue, classLoader);
            if (attributeInfo.isEncrypted() && attributes.containsKey(attributeName)) {
                encryptedAttributes.add(attributeName);
            }
        }

        // references can be coppied in blind
View Full Code Here

Examples of org.apache.geronimo.gbean.GAttributeInfo

        GBeanInfo gbeanInfo = data.getGBeanInfo();

        // set attributes
        for (Map.Entry<String, String> entry : getAttributes().entrySet()) {
            String attributeName = entry.getKey();
            GAttributeInfo attributeInfo = gbeanInfo.getAttribute(attributeName);
            if (attributeInfo == null) {
                throw new InvalidConfigException("No attribute: " + attributeName + " for gbean: " + data.getAbstractName());
            }
            String valueString = entry.getValue();
            Object value = getValue(attributeInfo, valueString, configName, gbeanName, classLoader);
            data.setAttribute(attributeName, value);
            // Read the latest encryption meta-information on attributes
            if (attributeInfo.isEncrypted()) {
                encryptedAttributes.add(attributeName);
            } else {
                encryptedAttributes.remove(attributeName);
            }
        }
View Full Code Here

Examples of org.apache.geronimo.gbean.GAttributeInfo

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

        try {
            GAttributeInfo invalidAttributeInfo = new GAttributeInfo(attributeName, String.class.getName(), false, false, null, null);

            new GBeanAttribute(gbeanInstance, invalidAttributeInfo, false);
            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, false);
            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, false);
            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, false);
            assertNotNull(attribute);
        }

        {
            final GAttributeInfo attributeInfo = new GAttributeInfo("YetAnotherFinalInt", int.class.getName(), true, false, null, "setCharAsYetAnotherFinalInt");
            try {
                new GBeanAttribute(gbeanInstance, attributeInfo, false);
                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, false);
                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, false);
                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, false);
                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, false);
                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, false);
                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, false);
                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, false);
                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, false);
                fail("Setter method not found on target; InvalidConfigurationException expected");
            } catch (InvalidConfigurationException expected) {
            }
View Full Code Here

Examples of org.apache.geronimo.gbean.GAttributeInfo

            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

Examples of org.apache.geronimo.gbean.GAttributeInfo

        interfaces = (String[]) gbeanInfo.getInterfaces().toArray(new String[0]);

        // attributes
        Map attributesMap = new HashMap();
        for (Iterator iterator = gbeanInfo.getAttributes().iterator(); iterator.hasNext();) {
            GAttributeInfo attributeInfo = (GAttributeInfo) iterator.next();
            attributesMap.put(attributeInfo.getName(), new GBeanAttribute(this, attributeInfo, constructorArgs.contains(attributeInfo.getName())));
        }
        addManagedObjectAttributes(attributesMap);
        attributes = (GBeanAttribute[]) attributesMap.values().toArray(new GBeanAttribute[attributesMap.size()]);
        for (int i = 0; i < attributes.length; i++) {
            attributeIndex.put(attributes[i].getName(), new Integer(i));
View Full Code Here

Examples of org.apache.geronimo.gbean.GAttributeInfo

        // special attributes are not encrypted
        this.encrypted = 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.encrypted,
                    this.readable,
                    this.writable,
                    attributeInfo.getGetterName(),
                    attributeInfo.getSetterName());
        } else {
            this.attributeInfo = new GAttributeInfo(this.name,
                    this.type.getName(),
                    this.persistent,
                    this.manageable,
                    this.encrypted,
                    this.readable,
View Full Code Here

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

Examples of org.apache.geronimo.gbean.GAttributeInfo

        interfaces = (String[]) gbeanInfo.getInterfaces().toArray(new String[0]);

        // attributes
        Map attributesMap = new HashMap();
        for (Iterator iterator = gbeanInfo.getAttributes().iterator(); iterator.hasNext();) {
            GAttributeInfo attributeInfo = (GAttributeInfo) iterator.next();
            attributesMap.put(attributeInfo.getName(), new GBeanAttribute(this, attributeInfo, constructorArgs.contains(attributeInfo.getName())));
        }
        addManagedObjectAttributes(attributesMap);
        attributes = (GBeanAttribute[]) attributesMap.values().toArray(new GBeanAttribute[attributesMap.size()]);
        for (int i = 0; i < attributes.length; i++) {
            attributeIndex.put(attributes[i].getName(), new Integer(i));
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.