Package org.exolab.castor.mapping

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


     * Test method.
     * @throws Exception For any exception thrown.
     */
    public void testMarshalEntity() throws Exception {
        Mapping mapping = new Mapping();
        mapping.loadMapping(getClass().getResource(MAPPING_FILE).toExternalForm());
       
        StringWriter out = new StringWriter();
        Marshaller marshaller = getXMLContext().createMarshaller();
        marshaller.setWriter(out);
        marshaller.setMapping(mapping);
View Full Code Here


        try {
            Generator ddlgen = GeneratorFactory.createDDLGenerator(
                    _databaseEngine, _globalProperties, _databaseEngineProperties);
           
            Mapping mapping = new Mapping();
            mapping.loadMapping(filePath);
            new MappingUnmarshaller().loadMappingOnly(mapping);
            // TODO: Joachim 2007-09-07 the InternalContext should be set into the unmarshaller!
           
            ddlgen.setMapping(mapping);
            ddlgen.generateDDL(_outputStream);
View Full Code Here

          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

        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

        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

            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

            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

     *         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

    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

                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

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.