KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > retriever > catalog > CatalogWriteModel


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 /*
21  * CatalogModel.java
22  *
23  * Created on October 11, 2005, 1:11 AM
24  */

25
26 package org.netbeans.modules.xml.retriever.catalog;
27
28 import java.beans.PropertyChangeListener JavaDoc;
29 import java.io.IOException JavaDoc;
30 import java.net.URI JavaDoc;
31 import java.util.Collection JavaDoc;
32 import org.netbeans.modules.xml.xam.dom.DocumentModel;
33 import org.netbeans.modules.xml.xam.locator.*;
34 import org.openide.filesystems.FileObject;
35
36 /**
37  * API interface for all the operations exposed
38  * by the CatalogModel. There will be one Catalog file per Project.
39  * @author girix
40  */

41 public interface CatalogWriteModel extends CatalogModel {
42     
43     public static final String JavaDoc CATALOG_FILE_EXTENSION = ".xml";
44     
45     public static final String JavaDoc PUBLIC_CATALOG_FILE_NAME = "catalog";
46     
47     /**
48      * Given the location parameter (schemaLocation for schema and location for wsdl)
49      * this method should return the parget URI after looking up in the public catalog file
50      * This method will just look up in the public catalog file and return result.
51      * If not found in the catalog a null will be returned.
52      *
53      * @param locationURI
54      * @return URI
55      */

56     public URI JavaDoc searchURI(URI JavaDoc locationURI);
57     
58     
59     /**
60      * Adds an URI to FileObject (in the same project) mapping in to the catalog.
61      * URI already present will be overwritten.
62      *
63      * This call might throw IllegalStateException if the catalog files are corrupted.
64      * Call isResolverStateValid() before calling this method to detect and avoid above exception
65      *
66      * @param locationURI
67      * @param fileObj
68      */

69     public void addURI(URI JavaDoc locationURI, FileObject fileObj) throws IOException JavaDoc;
70     
71     /**
72      * Adds an URI to URI mapping in to the catalog.
73      * URI already present will be overwritten.
74      *
75      * This call might throw IllegalStateException if the catalog files are corrupted.
76      * Call isResolverStateValid() before calling this method to detect and avoid above exception
77      *
78      * @param locationURI
79      * @param alternateURI
80      */

81     
82     public void addURI(URI JavaDoc locationURI, URI JavaDoc alternateURI) throws IOException JavaDoc;
83     
84     /**
85      * Remove a URI from the catalog.
86      * @param locationURI - locationURI to be removed.
87      */

88     public void removeURI(URI JavaDoc locationURI) throws IOException JavaDoc;
89     
90     
91     /**
92      * Returns list of all registered catalog entries
93      *
94      * This call might throw IllegalStateException if the catalog files are corrupted.
95      * Call isResolverStateValid() before calling this method to detect and avoid above exception
96      */

97     public Collection JavaDoc<CatalogEntry> getCatalogEntries();
98     
99     
100     /**
101      * This method tell if the resolver is in a sane state to retrive the correct values.
102      * If false is returned means there is some problem with the resolver. For more information
103      * call getState() to get the exact status message. This method should be called before calling
104      * most of the resolver methods.
105      */

106     public boolean isWellformed();
107     
108     
109     /**
110      * Returns the current satus of the resolver.
111      * Consult the return value and display appropriate messages to the user
112      */

113     public DocumentModel.State getState();
114     
115     
116     /**
117      * Returns the FileObject of the catalog file that this object is bound to.
118      */

119     public FileObject getCatalogFileObject();
120     
121     public void addPropertychangeListener(PropertyChangeListener JavaDoc pcl);
122     
123     public void removePropertyChangeListener(PropertyChangeListener JavaDoc pcl);
124     
125     
126     /**
127      * Adds nextCatalogFileURI to the catalog file as nextCatalog entry. If
128      * relativize is true and nextCatalogFileURI is absolute, then nextCatalogFileURI is
129      * relativized against this catalog file URI itself before writing.
130      */

131     public void addNextCatalog(URI JavaDoc nextCatalogFileURI, boolean relativize) throws IOException JavaDoc;
132     
133     public void removeNextCatalog(URI JavaDoc nextCatalogFileRelativeURI) throws IOException JavaDoc;
134     
135     
136 }
137
Popular Tags