1 /* 2 * (c) Copyright 2006-2020 by rapiddweller GmbH & Volker Bergmann. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, is permitted under the terms of the 6 * GNU General Public License. 7 * 8 * For redistributing this software or a derivative work under a license other 9 * than the GPL-compatible Free Software License as defined by the Free 10 * Software Foundation or approved by OSI, you must first obtain a commercial 11 * license to this software product from rapiddweller GmbH & Volker Bergmann. 12 * 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 14 * WITHOUT A WARRANTY OF ANY KIND. ALL EXPRESS OR IMPLIED CONDITIONS, 15 * REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE 17 * HEREBY EXCLUDED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24 * POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 package com.rapiddweller.benerator.engine.parser.xml; 28 29 import com.rapiddweller.benerator.engine.ResourceManager; 30 import com.rapiddweller.benerator.engine.Statement; 31 import com.rapiddweller.format.xml.ParseContext; 32 33 /** 34 * {@link ParseContext} implementation for Benerator. It defines parsers for all the descriptor XML elements.<br/><br/> 35 * Created: 14.12.2010 16:29:38 36 * 37 * @author Volker Bergmann 38 * @since 0.6.4 39 */ 40 public class BeneratorParseContext extends ParseContext<Statement> { 41 42 /** 43 * The Resource manager. 44 */ 45 final ResourceManager resourceManager; 46 47 /** 48 * Instantiates a new Benerator parse context. 49 * 50 * @param resourceManager the resource manager 51 */ 52 public BeneratorParseContext(ResourceManager resourceManager) { 53 super(Statement.class); 54 this.resourceManager = resourceManager; 55 factory.addParser(new BeanParser()); 56 factory.addParser(new BeepParser()); 57 factory.addParser(new CascadeParser()); 58 factory.addParser(new CommentParser()); 59 factory.addParser(new DatabaseParser()); 60 factory.addParser(new DefaultComponentParser()); 61 factory.addParser(new DOMTreeParser()); 62 factory.addParser(new EchoParser()); 63 factory.addParser(new ErrorParser()); 64 factory.addParser(new EvaluateParser()); 65 factory.addParser(new GenerateOrIterateParser()); 66 factory.addParser(new IfParser()); 67 factory.addParser(new ImportParser()); 68 factory.addParser(new IncludeParser()); 69 factory.addParser(new SettingParser()); 70 factory.addParser(new RunTaskParser()); 71 factory.addParser(new SetupParser()); 72 factory.addParser(new MemStoreParser()); 73 factory.addParser(new TranscodeParser()); 74 factory.addParser(new TranscodingTaskParser()); 75 factory.addParser(new WaitParser()); 76 factory.addParser(new WhileParser()); 77 } 78 79 /** 80 * Gets resource manager. 81 * 82 * @return the resource manager 83 */ 84 public ResourceManager getResourceManager() { 85 return resourceManager; 86 } 87 88 /** 89 * Create sub context benerator parse context. 90 * 91 * @param resourceManager the resource manager 92 * @return the benerator parse context 93 */ 94 public BeneratorParseContext createSubContext(ResourceManager resourceManager) { 95 return new BeneratorParseContext(resourceManager); 96 } 97 98 }