Clover coverage report - brownies library - 1.0-beta-1 Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00 FRAMES NO FRAMES |
file stats: | LOC: | 74 |  | Methods: | 4
| NCLOC: | 50 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
BrownieXmlS2ContainerBuilder.java | 0% | 0% | 0% | 0% |

1 |  |
     /*
2 |  |
      * brownies and its relative products are published under the terms
3 |  |
      * of the Apache Software License.
4 |  |
      *
5 |  |
      * Created on 2004/06/11 2:05:25
6 |  |
      */
7 |  |
     package org.asyrinx.brownie.seasar.container.factory;
8 |  |
9 |  |
     import java.io.IOException;
10 |  |
11 |  |
     import javax.xml.parsers.SAXParser;
12 |  |
     import javax.xml.parsers.SAXParserFactory;
13 |  |
14 |  |
     import org.asyrinx.brownie.core.io.sf.StreamFactory;
15 |  |
     import org.asyrinx.brownie.core.io.sf.StreamFactoryFacade;
16 |  |
     import org.seasar.framework.container.S2Container;
17 |  |
     import org.seasar.framework.container.factory.S2ContainerBuilder;
18 |  |
     import org.seasar.framework.container.factory.S2ContainerTagHandlerRule;
19 |  |
     import org.seasar.framework.container.factory.XmlS2ContainerBuilder;
20 |  |
     import org.seasar.framework.exception.IORuntimeException;
21 |  |
     import org.seasar.framework.util.SAXParserFactoryUtil;
22 |  |
     import org.seasar.framework.xml.SaxHandler;
23 |  |
     import org.seasar.framework.xml.SaxHandlerParser;
24 |  |
25 |  |
     /**
26 |  |
      * @author akima
27 |  |
      */
28 |  |
     public class BrownieXmlS2ContainerBuilder implements S2ContainerBuilder {
29 |  |
30 |  |
         private static S2ContainerTagHandlerRule rule_ = new BrownieS2ContainerTagHandlerRule();
31 |  |
32 | 0 |
         public BrownieXmlS2ContainerBuilder() {
33 | 0 |
             this(StreamFactoryFacade.newFacade());
34 |  |
         }
35 |  |
36 | 0 |
         public BrownieXmlS2ContainerBuilder(StreamFactory streamFactory) {
37 | 0 |
             this.streamFactory = streamFactory;
38 |  |
         }
39 |  |
40 |  |
         protected final StreamFactory streamFactory;
41 |  |
42 | 0 |
         public S2Container build(String path, ClassLoader classLoader) {
43 | 0 |
             S2Container container = null;
44 | 0 |
             ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
45 | 0 |
             try {
46 | 0 |
                 if (classLoader != null) {
47 | 0 |
                     Thread.currentThread().setContextClassLoader(classLoader);
48 |  |
                 }
49 | 0 |
                 container = build(path);
50 |  |
             } finally {
51 | 0 |
                 Thread.currentThread().setContextClassLoader(oldLoader);
52 |  |
             }
53 | 0 |
             return container;
54 |  |
         }
55 |  |
56 | 0 |
         public S2Container build(String path) {
57 | 0 |
             final SAXParserFactory factory = SAXParserFactoryUtil.newInstance();
58 | 0 |
             factory.setValidating(true);
59 | 0 |
             final SAXParser saxParser = SAXParserFactoryUtil.newSAXParser(factory);
60 | 0 |
             final SaxHandler handler = new SaxHandler(rule_);
61 | 0 |
             handler.registerDtdPath(XmlS2ContainerBuilder.PUBLIC_ID,
62 |  |
                     XmlS2ContainerBuilder.DTD_PATH);
63 | 0 |
             final SaxHandlerParser parser = new SaxHandlerParser(handler, saxParser);
64 |  |
             /*
65 |  |
              * ここが変わってます。
66 |  |
              */
67 | 0 |
             try {
68 | 0 |
                 return (S2Container) parser.parse(streamFactory.newInput(path));
69 |  |
             } catch (IOException e) {
70 | 0 |
                 throw new IORuntimeException(e);
71 |  |
             }
72 |  |
         }
73 |  |
74 |  |
     }