KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > xml > cookies > CheckXMLSupport


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.spi.xml.cookies;
20
21 import org.xml.sax.InputSource JavaDoc;
22
23 import org.netbeans.api.xml.cookies.*;
24
25 /**
26  * <code>CheckXMLCookie</code> implementation support simplifing cookie providers
27  * based on <code>InputSource</code>s representing XML documents and entities.
28  * <p>
29  * <b>Primary use case</b> in a DataObject subclass (which primary file is XML):
30  * <pre>
31  * CookieSet cookies = getCookieSet();
32  * InputSource in = DataObjectAdapters.inputSource(this);
33  * CheckXMLSupport cookieImpl = new CheckXMLSupport(in);
34  * cookies.add(cookieImpl);
35  * </pre>
36  * <p>
37  * <b>Secondary use case:</b> Subclasses can customize the class by customization
38  * protected methods. The customized subclass can be used according to
39  * primary use case.
40  *
41  * @author Petr Kuzel
42  */

43 public class CheckXMLSupport extends SharedXMLSupport implements CheckXMLCookie {
44         
45     /**
46      * General parsed entity strategy. This strategy works well only for
47      * standalone (no entity reference) external entities.
48      */

49     public static final int CHECK_ENTITY_MODE = 1;
50     
51     /**
52      * Parameter parsed entity strategy. This strategy is suitable for standalone
53      * (no undeclared parameter entity reference) external DTDs.
54      */

55     public static final int CHECK_PARAMETER_ENTITY_MODE = 2;
56     
57     /**
58      * XML document entity strategy. It is ordinary XML document processing mode.
59      */

60     public static final int DOCUMENT_MODE = 3;
61     
62     /**
63      * Create new CheckXMLSupport for given data object using DOCUMENT_MODE strategy.
64      * @param inputSource Supported data object.
65      */

66     public CheckXMLSupport(InputSource JavaDoc inputSource) {
67         super(inputSource);
68     }
69     
70     /**
71      * Create new CheckXMLSupport for given data object.
72      * @param inputSource Supported data object.
73      * @param strategy One of <code>*_MODE</code> constants.
74      */

75     public CheckXMLSupport(InputSource JavaDoc inputSource, int strategy) {
76         super(inputSource, strategy);
77     }
78
79     // inherit JavaDoc
80
public boolean checkXML(CookieObserver l) {
81         return super.checkXML(l);
82     }
83 }
84
85
Popular Tags