Package org.apache.xmlbeans.impl.tool
Class BaseSchemaResourceManager
java.lang.Object
org.apache.xmlbeans.impl.tool.SchemaImportResolver
org.apache.xmlbeans.impl.tool.BaseSchemaResourceManager
- Direct Known Subclasses:
SchemaResourceManager
public abstract class BaseSchemaResourceManager extends SchemaImportResolver
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseSchemaResourceManager() -
Method Summary
Modifier and Type Method Description protected abstract voiddeleteFile(String filename)Deletes a file.protected abstract booleanfileExists(String filename)Returns true if the given filename exists.protected abstract String[]getAllXSDFilenames()Returns a list of all the XSD filesnames in the project.protected StringgetDefaultSchemaDir()protected StringgetIndexFilename()protected voidinit()protected abstract InputStreaminputStreamForFile(String filename)Gets the data in the given filename as an InputStream.SchemaImportResolver.SchemaResourcelookupResource(String nsURI, String schemaLocation)Called when the ImportLoader wishes to resolve the given import.voidprocess(String[] uris, String[] filenames, boolean sync, boolean refresh, boolean imports)voidprocessAll(boolean sync, boolean refresh, boolean imports)voidreportActualNamespace(SchemaImportResolver.SchemaResource rresource, String actualNamespace)Updates actual namespace in the table.voidsyncCacheWithLocalXsdFiles(String[] filenames, boolean deleteOnlyMentioned)Adds items to the cache that point to new files that aren't described in the cache, and optionally deletes old entries.protected abstract voidwarning(String msg)Produces diagnostic messages such as "downloading X to file Y".voidwriteCache()protected abstract voidwriteInputStreamToFile(InputStream input, String filename)Writes an entire file in one step.
-
Constructor Details
-
BaseSchemaResourceManager
protected BaseSchemaResourceManager()
-
-
Method Details
-
init
protected final void init() -
writeCache
- Throws:
IOException
-
processAll
public final void processAll(boolean sync, boolean refresh, boolean imports) -
process
-
syncCacheWithLocalXsdFiles
Adds items to the cache that point to new files that aren't described in the cache, and optionally deletes old entries.If an old file is gone and a new file is found with exactly the same contents, the cache entry is moved to point to the new file.
-
lookupResource
Called when the ImportLoader wishes to resolve the given import. Should return a SchemaResource whose "equals" relationship reveals when a SchemaResource is duplicated and shouldn't be examined again.Returns null if the resource reference should be ignored.
- Specified by:
lookupResourcein classSchemaImportResolver
-
reportActualNamespace
public void reportActualNamespace(SchemaImportResolver.SchemaResource rresource, String actualNamespace)Updates actual namespace in the table.- Specified by:
reportActualNamespacein classSchemaImportResolver
-
getIndexFilename
-
getDefaultSchemaDir
-
warning
Produces diagnostic messages such as "downloading X to file Y". -
fileExists
Returns true if the given filename exists. The filenames are of the form "/foo/bar/zee.xsd" and should be construed as rooted at the root of the project. -
inputStreamForFile
Gets the data in the given filename as an InputStream.- Throws:
IOException
-
writeInputStreamToFile
protected abstract void writeInputStreamToFile(InputStream input, String filename) throws IOExceptionWrites an entire file in one step. An InputStream is passed and copied to the file.- Throws:
IOException
-
deleteFile
Deletes a file. Sometimes immediately after writing a new file we notice that it's exactly the same as an existing file and we delete it. We never delete a file that was given to us by the user. -
getAllXSDFilenames
Returns a list of all the XSD filesnames in the project.
-