Package org.objectweb.celtix.configuration.impl

Examples of org.objectweb.celtix.configuration.impl.TypeSchema


    public Object getValue() {
        Object o = super.getValue();
        if (o instanceof Element) {
            Element el = (Element)o;
            QName type = new QName(el.getNamespaceURI(), el.getLocalName());
            TypeSchema ts = new TypeSchemaHelper(true).get(type.getNamespaceURI());
            if (null == ts) {
                throw new ConfigurationException(new Message("JAXB_PROPERTY_EDITOR_EXC", LOG, type));
            }
            try {
                return ts.unmarshal(type, el);
            } catch (JAXBException ex) {
                Message msg = new Message("JAXB_PROPERTY_EDITOR_EXC", LOG, type);
                throw new ConfigurationException(msg, ex);
            }
        }
View Full Code Here


                Node node = chainNodes.item(i);
                if (Node.ELEMENT_NODE == node.getNodeType()
                    && HANDLER_CHAIN_ELEM_NAME.equals(getNodeName(node))) {

                    String location = "schemas/configuration/jaxws-types.xsd";
                    TypeSchema ts = new TypeSchemaHelper(true).get(JAXWS_TYPES_URI, null, location);

                    ConfigurationItemMetadata mdi = new ConfigurationItemMetadata() {
                        public Object getDefaultValue() {
                            return null;
                        }

                        public LifecyclePolicy getLifecyclePolicy() {
                            return LifecyclePolicy.STATIC;
                        }

                        public String getName() {
                            return "handlerChain";
                        }

                        public QName getType() {
                            return new QName(JAXWS_TYPES_URI, HANDLER_CHAIN_TYPE_NAME);
                        }

                    };

                    Object obj = ts.unmarshalDefaultValue(mdi, (Element)node, doValidate);
                    chains.add((HandlerChainType)obj);
                }
            }
        } catch (Exception ex) {
            if (ex instanceof WebServiceException) {
View Full Code Here

    public Object getValue() {
        Object o = super.getValue();
        if (o instanceof Element) {
            Element el = (Element)o;
            QName type = new QName(el.getNamespaceURI(), el.getLocalName());
            TypeSchema ts = new TypeSchemaHelper(true).get(type.getNamespaceURI());
            if (null == ts) {
                throw new ConfigurationException(new Message("JAXB_PROPERTY_EDITOR_EXC", LOG, type));
            }
            try {
                return ts.unmarshal(type, el);
            } catch (JAXBException ex) {
                Message msg = new Message("JAXB_PROPERTY_EDITOR_EXC", LOG, type);
                throw new ConfigurationException(msg, ex);
            }
        }
View Full Code Here

    public Object getValue() {
        Object o = super.getValue();
        if (o instanceof Element) {
            Element el = (Element)o;
            QName type = new QName(el.getNamespaceURI(), el.getLocalName());
            TypeSchema ts = new TypeSchemaHelper(true).get(type.getNamespaceURI());
            if (null == ts) {
                throw new ConfigurationException(new Message("JAXB_PROPERTY_EDITOR_EXC", LOG, type));
            }
            try {
                return ts.unmarshal(type, el);
            } catch (JAXBException ex) {
                Message msg = new Message("JAXB_PROPERTY_EDITOR_EXC", LOG, type);
                throw new ConfigurationException(msg, ex);
            }
        }
View Full Code Here

        pw.println("    }");
    }
   
    public static String getClassName(QName typeName, boolean qualified) {
        String baseType = null;
        TypeSchema ts = null;
        if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeName.getNamespaceURI())) {
            baseType = typeName.getLocalPart();
        } else {
            ts = new TypeSchemaHelper(false).get(typeName.getNamespaceURI());
            baseType = ts.getXMLSchemaBaseType(typeName.getLocalPart());
        }
        String className = null;
        if (null != baseType) {
            className = JAXBUtils.builtInTypeToJavaType(baseType);
            if (className != null && !qualified) {
                int index = className.lastIndexOf('.');
                if (index >= 0) {
                    className = className.substring(index + 1);
                }
            }
        }
        if (null == className) {
            baseType = typeName.getLocalPart();
            className = JAXBUtils.nameToIdentifier(baseType,
                                                   JAXBUtils.IdentifierType.CLASS);
            if (qualified) {
                className = ts.getPackageName() + "." + className;
            }
        }
        return className;
    }
View Full Code Here

        String testURI = "http://celtix.objectweb.org/configuration/test/types";
        element.getNamespaceURI();
        EasyMock.expectLastCall().andReturn(testURI);
        element.getLocalName();
        EasyMock.expectLastCall().andReturn(typename);
        TypeSchema ts = org.easymock.classextension.EasyMock.createMock(TypeSchema.class);
        TypeSchemaHelper tsh = new TypeSchemaHelper(true);
        tsh.put(testURI, ts);
        ts.unmarshal(new QName(testURI, typename), element);
        EasyMock.expectLastCall().andReturn(value);
        EasyMock.replay(element);
        org.easymock.classextension.EasyMock.replay(ts);
      
        pe.setValue(element);
        Object o = pe.getValue();
        assertTrue(o == value);
       
        EasyMock.reset(element);
        org.easymock.classextension.EasyMock.reset(ts);
       
        element.getNamespaceURI();
        EasyMock.expectLastCall().andReturn(testURI);
        element.getLocalName();
        EasyMock.expectLastCall().andReturn(typename);
        ts.unmarshal(new QName(testURI, typename), element);
        EasyMock.expectLastCall().andThrow(new JAXBException("test"));
        EasyMock.replay(element);
        org.easymock.classextension.EasyMock.replay(ts);
        try {
            pe.getValue();
View Full Code Here

TOP

Related Classes of org.objectweb.celtix.configuration.impl.TypeSchema

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.