Package org.exolab.castor.mapping

Examples of org.exolab.castor.mapping.Mapping


    private WebServicesFactory() {
        ClassLoader classLoader = WebServicesFactory.class.getClassLoader();
        URL mappingUrl = classLoader.getResource("org/apache/geronimo/webservices/webservices_1_1.xml");

        try {
            mapping = new Mapping(classLoader);
            mapping.loadMapping(mappingUrl);
            unmarshaller = new Unmarshaller(mapping);
        } catch (Exception e) {
            throw (IllegalStateException)new IllegalStateException("Unable to initialize xml unmarshaller").initCause(e);
        }
View Full Code Here


    private void insertBean (String name, Object bean, String map) {
        try {
            Marshaller marshaller = new Marshaller(new IncludeXMLConsumer(super.contentHandler));
            try {
                Mapping mapping = null;
                if (map != null) {
                    mapping = loadMapping(map);
                } else {
                    mapping = defaultMapping;
                }
View Full Code Here

            // Create cache (once) if does not exist
            if (mappings == null) {
                mappings = new HashMap();
            }

            Mapping mapping;
            Source source = resolver.resolveURI(file);
            try {
                mapping = (Mapping) mappings.get(source.getURI());
                if (mapping == null) {
                    // mapping not found in cache or the cache is new
                    mapping = new Mapping();
                    InputSource in = new InputSource(source.getInputStream());
                    mapping.loadMapping(in);
                    mappings.put (source.getURI(), mapping);
                }
            } finally {
                resolver.release(source);
            }
View Full Code Here

        this.debug = false;
    }

    public void testUnmarshalWebXml() throws Exception {
        URL webXmlMapping = getClass().getResource("castor-web-xml-mapping.xml");
        Mapping mapping = new Mapping();
        mapping.loadMapping(webXmlMapping);
        InputStream webXml = getClass().getResourceAsStream("web.xml");
        Unmarshaller unmarshaller = new Unmarshaller(mapping);
        unmarshaller.setIgnoreExtraElements(false);
        unmarshaller.setDebug(debug);
        WebAppDD config = (WebAppDD)unmarshaller.unmarshal(new InputStreamReader(webXml));
View Full Code Here

        assertTrue(config!=null);
    }

    public void testMarshalWebXml() throws Exception {
        URL webXmlMapping = getClass().getResource("castor-web-xml-mapping.xml");
        Mapping mapping = new Mapping();
        mapping.loadMapping(webXmlMapping);
        InputStream webXml = getClass().getResourceAsStream("web.xml");
        Unmarshaller unmarshaller = new Unmarshaller(mapping);
        WebAppDD config = (WebAppDD)unmarshaller.unmarshal(new InputStreamReader(webXml));

           OutputFormat of = new OutputFormat();
View Full Code Here

     */
    protected Object readInternal() throws IOException {
        Object object = null;
        InputStream is = getInputStream();
        try {
            Mapping mapping = getCastorMapping();
            Unmarshaller unmarshaller = new Unmarshaller(mapping);
            unmarshaller.setEntityResolver(new EntityResolverImpl());
            unmarshaller.setIgnoreExtraElements(getIgnoreExtraElements());
            if(is!=null) {
                InputStreamReader in = new InputStreamReader(is);
View Full Code Here

     * @throws MappingException
     */
    protected Mapping getCastorMapping()
    throws IOException, MappingException {
        URL url = WebAppDD.class.getResource(WEB_XML_MAPPING);
        Mapping mapping = new Mapping();
        mapping.loadMapping(url);
        return mapping;
    }
View Full Code Here

     */
    protected Mapping getCastorMapping()
    throws IOException, MappingException {
        URL url = PortletAppDD.class.getResource(PORTLET_XML_MAPPING);
        //dump(url);
        Mapping mapping = new Mapping();
        mapping.loadMapping(url);
        return mapping;
    }
View Full Code Here

        if(url == null) {
            throw new NullPointerException(
                    "Configuration Error.  Resource: "+PORTLET_XML_MAPPING+" not found."
            );
        }
        Mapping mapping = new Mapping();
        mapping.loadMapping(url);
        return mapping;
    }
View Full Code Here

     * @throws IOException
     */
    protected Object readInternal(InputStream is) throws IOException {
        Object object = null;
        try {
            Mapping mapping = getCastorMapping();
            Unmarshaller unmarshaller = new Unmarshaller(mapping);
            unmarshaller.setEntityResolver(new EntityResolverImpl());
            unmarshaller.setIgnoreExtraElements(getIgnoreExtraElements());
            if(is!=null) {
                InputStreamReader in = new InputStreamReader(is);
View Full Code Here

TOP

Related Classes of org.exolab.castor.mapping.Mapping

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.