Examples of loadMapping()


Examples of org.exolab.castor.mapping.Mapping.loadMapping()

          try //Load the mapping file
            Mapping mapping= new Mapping(getClass().getClassLoader());

            is = this.getClass().getResourceAsStream(TYPE_MAPPINGS);
        mapping.loadMapping( new InputSource(is) );

                //unmarshall the list of built in simple types
            Unmarshaller unmarshaller= new Unmarshaller(TypeList.class);
            unmarshaller.setMapping(mapping);
            //-- turn off validation
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

        URL url = classLoader.getResource(ResolveHelpers.getQualifiedFileName(
                XMLConstants.PKG_MAPPING_FILE, packageName));
        if (url == null) { return null; }
        try {
            Mapping mapping = new Mapping(classLoader);
            mapping.loadMapping(url);
            return mapping;
        } catch (java.io.IOException ioex) {
            throw new MappingException(ioex);
        }
    }
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

        try {
            Generator generator = GeneratorFactory.createDDLGenerator(
                    engine, globalConfig, specificConfig);

            Mapping mapping = new Mapping();
            mapping.loadMapping(mappingName);
            new MappingUnmarshaller().loadMappingOnly(mapping);
            // TODO: Joachim 2007-09-07 the InternalContext should be set into the unmarshaller!
           
            generator.setMapping(mapping);
            generator.generateDDL(new FileOutputStream(ddlName));           
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

            InputStream strmMapping = this.getClass().getClassLoader().getResourceAsStream("withmapping-mapping.xml");
            Assert.assertNotNull("InputStream of mapping must not be null", strmMapping);
            InputSource srcMapping = new InputSource(strmMapping);
            Assert.assertNotNull("InputSource of mapping must not be null", srcMapping);
            Mapping mapping = new Mapping();
            mapping.loadMapping(srcMapping);
            context.addMapping(mapping);
            Unmarshaller unmarshaller = context.createUnmarshaller();
            InputStream stream = this.getClass().getClassLoader().getResourceAsStream("withmapping-input.xml");
            Assert.assertNotNull("InputStream must not be null", stream);
            InputSource is = new InputSource(stream);
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

            InputStream strmMapping = this.getClass().getClassLoader().getResourceAsStream("withmapping-mapping.xml");
            Assert.assertNotNull("InputStream of mapping must not be null", strmMapping);
            InputSource srcMapping = new InputSource(strmMapping);
            Assert.assertNotNull("InputSource of mapping must not be null", srcMapping);
            Mapping mapping = new Mapping();
            mapping.loadMapping(srcMapping);
            ClassDescriptorResolver classDescriptorResolver = ClassDescriptorResolverFactory
                    .createClassDescriptorResolver(BindingType.XML);
            MappingUnmarshaller mappingUnmarshaller = new MappingUnmarshaller();
            MappingLoader mappingLoader = mappingUnmarshaller.getMappingLoader(
                    mapping, BindingType.XML);
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

     *         patterns.
     */
    public static Expected getExpectedResult(final URL expected) throws Exception {
        // 1. Load the mapping information from the file
        Mapping mapping = new Mapping();
        mapping.loadMapping(Expected.class.getResource(MAPPING));
       
        // 2. Unmarshal the data
        Unmarshaller unmar = new Unmarshaller(mapping);
        InputSource source = new InputSource(expected.toExternalForm());
        return (Expected) unmar.unmarshal(source);
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

    protected final void loadData(final String filename) throws Exception {
        Class cls = AbstractGeneratorTest.class;
       
        URL mappingURL = cls.getResource(MAPPING_PATH + filename);
        Mapping mapping = new Mapping();
        mapping.loadMapping(mappingURL);
        new MappingUnmarshaller().loadMappingOnly(mapping);
        // TODO: Joachim 2007-09-07 the InternalContext should be set into the unmarshaller!
        _generator.setMapping(mapping);
        _generator.createSchema();
View Full Code Here

Examples of org.exolab.castor.mapping.Mapping.loadMapping()

                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

Examples of org.exolab.castor.mapping.loader.AbstractMappingLoader.loadMapping()

            loader = (AbstractMappingLoader) _registry.getMappingLoader(
                    "CastorXmlMapping", bindingType);
            loader.setClassLoader(mapping.getClassLoader());
            loader.setAllowRedefinitions(_allowRedefinitions);
            loader.setInternalContext(_internalContext);
            loader.loadMapping(mapping.getRoot(), param);
            return loader;
        }
    }

    public void loadMappingOnly(final Mapping mapping)
View Full Code Here

Examples of org.exolab.castor.mapping.loader.MappingLoader.loadMapping()

                // Put loader in hash table first, so we don't get an error message if this
                // method is called a second time
                resolver = loaderImpl;
                _resolvers.put( engine, resolver );
                loaderImpl.setAllowRedefinitions(_allowRedefinitions);
                loaderImpl.loadMapping( _mapping, param );
            }
            catch ( Exception except ) {
                throw new MappingException( except );
            }
        }
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.