1 /* 2 * Copyright 2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.properties.jboss.extension.parser; 17 18 import java.util.List; 19 20 import javax.xml.stream.XMLStreamException; 21 22 import org.jboss.as.controller.persistence.SubsystemMarshallingContext; 23 import org.jboss.dmr.ModelNode; 24 import org.jboss.staxmapper.XMLElementReader; 25 import org.jboss.staxmapper.XMLElementWriter; 26 import org.jboss.staxmapper.XMLExtendedStreamReader; 27 import org.jboss.staxmapper.XMLExtendedStreamWriter; 28 29 /** 30 * The parser to read and write configurations of the subsystem. 31 */ 32 public final class SubsystemParser implements 33 XMLElementReader<List<ModelNode>>, 34 XMLElementWriter<SubsystemMarshallingContext> 35 { 36 // ********************************* Fields ********************************* 37 38 // --- constants ------------------------------------------------------------ 39 40 // --- members -------------------------------------------------------------- 41 42 // ****************************** Initializer ******************************* 43 44 // ****************************** Constructors ****************************** 45 46 /** 47 * Default constructor. 48 */ 49 public SubsystemParser() 50 { 51 } 52 53 // ****************************** Inner Classes ***************************** 54 55 // ********************************* Methods ******************************** 56 57 // --- init ----------------------------------------------------------------- 58 59 // --- get&set -------------------------------------------------------------- 60 61 // --- business ------------------------------------------------------------- 62 63 @Override 64 public void writeContent(final XMLExtendedStreamWriter writer, 65 final SubsystemMarshallingContext context) throws XMLStreamException 66 { 67 final ConfigurationWriter parser = new ConfigurationWriter(); 68 parser.writeContent(writer, context); 69 } 70 71 @Override 72 public void readElement(final XMLExtendedStreamReader reader, 73 final List<ModelNode> list) throws XMLStreamException 74 { 75 final ConfigurationReader parser = new ConfigurationReader(); 76 parser.readElement(reader, list); 77 } 78 79 // --- object basics -------------------------------------------------------- 80 81 }