|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Context2SimpleXPathOld.java | - | - | 0% | 0% |
|
1 | /* $Id: Context2SimpleXPathOld.java,v 1.2 2007/04/12 23:50:10 m31 Exp $ | |
2 | * | |
3 | * This file is part of the project "Hilbert II" - http://www.qedeq.org | |
4 | * | |
5 | * Copyright 2000-2007, Michael Meyling <mime@qedeq.org>. | |
6 | * | |
7 | * "Hilbert II" is free software; you can redistribute | |
8 | * it and/or modify it under the terms of the GNU General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2 of the License, or (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | */ | |
17 | ||
18 | package org.qedeq.kernel.xml.mapper; | |
19 | ||
20 | import java.io.IOException; | |
21 | ||
22 | import javax.xml.parsers.ParserConfigurationException; | |
23 | ||
24 | import org.qedeq.kernel.bo.module.ModuleContext; | |
25 | import org.qedeq.kernel.xml.tracker.SimpleXPath; | |
26 | import org.qedeq.kernel.xml.tracker.XPathLocationFinder; | |
27 | import org.xml.sax.SAXException; | |
28 | ||
29 | /** | |
30 | * Parses complete QEDEQ modules to find a context location.. | |
31 | * | |
32 | * <p> | |
33 | * Not in use any more. | |
34 | * | |
35 | * @version $Revision: 1.2 $ | |
36 | * @author Michael Meyling | |
37 | * @deprecated | |
38 | */ | |
39 | public final class Context2SimpleXPathOld { | |
40 | ||
41 | /** | |
42 | * Constructor. | |
43 | */ | |
44 | 0 | private Context2SimpleXPathOld() { |
45 | // nothing to do | |
46 | } | |
47 | ||
48 | /** | |
49 | * Transform context information into XML specific location information. | |
50 | * | |
51 | * @param context Abstract context description. | |
52 | * @return Information where the context could be found. | |
53 | * @throws RuntimeException Don't! | |
54 | * @deprecated | |
55 | */ | |
56 | public static final SimpleXPath getXPath(final ModuleContext context) { | |
57 | String xpath = Context2XPathOld.getXPath(context); | |
58 | try { | |
59 | final SimpleXPath find = XPathLocationFinder.getXPathLocation( | |
60 | context.getModuleLocation(), xpath); | |
61 | if (find.getStartLocation() == null) { | |
62 | System.out.println(context); | |
63 | throw new RuntimeException("start not found: " + find); | |
64 | } | |
65 | if (find.getEndLocation() == null) { | |
66 | System.out.println(context); | |
67 | throw new RuntimeException("end not found: " + find); | |
68 | } | |
69 | return find; | |
70 | } catch (ParserConfigurationException e) { | |
71 | throw new RuntimeException(e); | |
72 | } catch (SAXException e) { | |
73 | throw new RuntimeException(e); | |
74 | } catch (IOException e) { | |
75 | throw new RuntimeException(e); | |
76 | } | |
77 | } | |
78 | ||
79 | } |
|