KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > model > SchemaModel


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
20 package org.netbeans.modules.xml.schema.model;
21 import java.util.Collection JavaDoc;
22 import org.netbeans.modules.xml.xam.NamedReferenceable;
23 import org.netbeans.modules.xml.xam.Referenceable;
24 import org.netbeans.modules.xml.xam.dom.DocumentModel;
25
26 /**
27  * This interface represents an instance of a schema model. A schema model is
28  * bound to a single file.
29  * @author Chris Webster
30  */

31 public interface SchemaModel extends DocumentModel<SchemaComponent>, Referenceable {
32     
33     /**
34      * @return the schema represented by this model. The returned schema
35      * instance will be valid and well formed, thus attempting to update
36      * from a document which is not well formed will not result in any changes
37      * to the schema model.
38      */

39     Schema getSchema();
40         
41     /**
42      * This api returns the effective namespace for a given component.
43      * If given component has a targetNamespace different than the
44      * this schema, that namespace is returned. The special case is that if
45      * the targetNamespace of the component is null, there is no target
46      * namespace defined, then the import statements for this file are
47      * examined to determine if this component is directly or indirectly
48      * imported. If the component is imported, then null if returned
49      * otherwise the component is assumed to be included or redefined and
50      * the namespace of this schema is returned.
51      * @param component The component which namespace to find
52      * @return The effective target namespace
53      */

54     String JavaDoc getEffectiveNamespace(SchemaComponent component);
55     
56     /**
57      * @return common schema element factory valid for this instance
58      */

59     SchemaComponentFactory getFactory();
60     
61         /**
62          * Returns all visible schemas matching the given namespace.
63          * Note visibility rule is defined as following:
64          * (1) Include or redefine are transitive, i.e., includer can see all schemas
65          * included or redefined by the included
66          * (2) Import is not transitive, i.e., importing schema can only see the
67          * imported schema, but not those included, redefined or imported by the imported.
68          * (3) Imported schemas are not visible to includer or redefiner.
69          */

70         Collection JavaDoc<Schema> findSchemas(String JavaDoc namespaceURI);
71
72         /**
73          * Finds the component in current schema by local name and type.
74          * @param localName the local name of the schema component.
75          * @param type the exact type of the schema component.
76          * @return first encountered of the schema component of specified name and type;
77          * null if not found.
78          */

79         <T extends NamedReferenceable> T findByNameAndType(String JavaDoc localName, Class JavaDoc<T> type);
80         
81         /**
82          * Resolves the reference to component given namespace and local name.
83          * @param namespace the namespace of the referenced component
84          * @param localName local name of the refrenced component.
85          * @param type type of the component.
86          */

87         <T extends NamedReferenceable> T resolve(String JavaDoc namespace, String JavaDoc localName, Class JavaDoc<T> type);
88 }
89
Popular Tags