[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.plugin.mfc;
|
---|
[1] | 16 |
|
---|
[1084] | 17 | import org.xml.sax.SAXException;
|
---|
| 18 |
|
---|
[1006] | 19 | import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree;
|
---|
[619] | 20 |
|
---|
[171] | 21 | /**
|
---|
| 22 | * <p>
|
---|
[619] | 23 | * Base class to define custom message handlers, for messages that shall be handled differently
|
---|
| 24 | * during the parsing of usage logs. It provides dummy implementations for all required methods,
|
---|
| 25 | * such that implementations can only overwrite the parts they actually require and ignore the rest.
|
---|
[171] | 26 | * </p>
|
---|
| 27 | *
|
---|
| 28 | * @author Steffen Herbold
|
---|
[1006] | 29 | * @author Fabian Glaser
|
---|
[171] | 30 | * @version 1.0
|
---|
| 31 | */
|
---|
| 32 | public class MessageHandler {
|
---|
[1] | 33 |
|
---|
[619] | 34 | /**
|
---|
| 35 | * <p>
|
---|
| 36 | * during parsing, a tree of GUI elements is created and adapted.
|
---|
| 37 | * This is the reference to it.
|
---|
| 38 | * </p>
|
---|
| 39 | */
|
---|
[1028] | 40 | private GUIElementTree<Long> guiElementTree;
|
---|
[171] | 41 |
|
---|
[619] | 42 | /**
|
---|
| 43 | * <p>
|
---|
| 44 | * Constructor. Protected to prohibit initialization of the base class itself.
|
---|
| 45 | * </p>
|
---|
| 46 | *
|
---|
[1006] | 47 | * @param guiElementTree the tree of GUI element specifications to be created and adapted during
|
---|
[619] | 48 | * parsing
|
---|
| 49 | */
|
---|
[1028] | 50 | protected MessageHandler(GUIElementTree<Long> guiElementTree) {
|
---|
[1006] | 51 | this.guiElementTree = guiElementTree;
|
---|
[619] | 52 | }
|
---|
[171] | 53 |
|
---|
[619] | 54 | /**
|
---|
| 55 | * <p>
|
---|
| 56 | * Called in the startElement() method of the {@link MFCLogParser} when a msg-node begins.
|
---|
| 57 | * </p>
|
---|
| 58 | */
|
---|
| 59 | public void onStartElement() {}
|
---|
[171] | 60 |
|
---|
[619] | 61 | /**
|
---|
| 62 | * <p>
|
---|
| 63 | * Called by the {@link MFCLogParser} to handle param-nodes.
|
---|
| 64 | * </p>
|
---|
| 65 | *
|
---|
| 66 | * @param name
|
---|
| 67 | * name (type) of the parameter
|
---|
| 68 | * @param value
|
---|
| 69 | * value of the parameter
|
---|
| 70 | */
|
---|
| 71 | public void onParameter(String name, String value) {}
|
---|
| 72 |
|
---|
| 73 | /**
|
---|
| 74 | * <p>
|
---|
| 75 | * Called in the endElement() method of {@link MFCLogParser} when a msg-node ends.
|
---|
| 76 | * </p>
|
---|
[1084] | 77 | *
|
---|
| 78 | * @throws SAXException if the msg-node could not be processed for some reason
|
---|
[619] | 79 | */
|
---|
[1084] | 80 | public void onEndElement() throws SAXException {}
|
---|
[619] | 81 |
|
---|
| 82 | /**
|
---|
[1006] | 83 | * @return the gui element tree created and adapted during parsing
|
---|
[619] | 84 | */
|
---|
[1028] | 85 | protected GUIElementTree<Long> getGUIElementTree() {
|
---|
[1006] | 86 | return guiElementTree;
|
---|
[619] | 87 | }
|
---|
| 88 |
|
---|
[1] | 89 | }
|
---|