KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > node > SaxParserHandlerFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment.node;
25
26 /**
27  *Provides the appropriate implementation depending on the current
28  *runtime environment.
29  *
30  * @author tjquinn
31  */

32 public class SaxParserHandlerFactory {
33     
34     /** Creates a new instance of SaxParserHandlerFactory */
35     public SaxParserHandlerFactory() {
36     }
37     
38     public static SaxParserHandler newInstance() {
39         SaxParserHandler result = null;
40         
41         /*
42          *If the property com.sun.aas.installRoot is defined, use the
43          *original implementation (SaxParserHandler) which fetches DTDs and
44          *schemas from the installation directory tree. Otherwise, assume that
45          *the app client container is running under Java Web Start. In that
46          *case, there is no product installation directory (at least none can
47          *be assumed). The DTDs and schemas will be retrieved from the
48          *JWS-specific jar file instead (SaxParserHandlerBundled).
49          */

50         if (System.getProperty("com.sun.aas.installRoot") == null) {
51             result = new SaxParserHandlerBundled();
52         } else {
53             result = new SaxParserHandler();
54         }
55         return result;
56     }
57 }
58
Popular Tags