01: /*
02: * $Id: InteractionHandler.java 543 2005-10-06 09:09:08Z nebulosu $
03: * (c) Copyright 2004 con:cern development team.
04: *
05: * This file is part of con:cern (http://concern.org).
06: *
07: * con:cern is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU Lesser General Public License
09: * as published by the Free Software Foundation; either version 2.1
10: * of the License, or (at your option) any later version.
11: *
12: * Please see COPYING for the complete licence.
13: */
14: package org.concern.model.cpd;
15:
16: import org.xml.sax.Attributes;
17: import org.xml.sax.SAXException;
18: import org.concern.model.Interaction;
19:
20: public class InteractionHandler extends ScopeHandler {
21: private Interaction interaction;
22:
23: public InteractionHandler() {
24: }
25:
26: public Interaction getInteraction() {
27: return interaction;
28: }
29:
30: public void startElement(String uri, String localName,
31: String qName, Attributes attributes) throws SAXException {
32: interaction = new Interaction();
33: if ("in".equals(attributes.getValue("direction")))
34: interaction.setDirection(Interaction.IN);
35: else if ("out".equals(attributes.getValue("direction")))
36: interaction.setDirection(Interaction.OUT);
37: else if ("both".equals(attributes.getValue("direction")))
38: interaction.setDirection(Interaction.BOTH);
39: interaction.setMessage(attributes.getValue("message"));
40: interaction
41: .setCollaborator(attributes.getValue("collaborator"));
42: }
43:
44: public void characters(char ch[], int start, int length)
45: throws SAXException {
46: }
47:
48: public void endElement(String uri, String localName, String qName)
49: throws SAXException {
50: }
51:
52: public ScopeHandler getHandler(String localName, String qName) {
53: throw new RuntimeException("unexpected tag " + localName + " "
54: + qName);
55: }
56:
57: public void fetchChild(ScopeHandler handler) {
58: }
59: }
|