org.topbraid.core.registry
Interface IFileRegistry

All Known Implementing Classes:
FileRegistry, TBCFileRegistry

public interface IFileRegistry

An interface for objects managing the available graph files for TopBraid. This typically wraps an existing Eclipse workspace and uses file introspection to maintain a mapping of URIs to files (and vice versa). TopBraid applications can access the global file registry using TB.getFileRegistry().

Author:
Holger Knublauch

Method Summary
 java.net.URI getBaseURI(org.eclipse.core.resources.IFile file)
          Gets the base URI that is known to be represented by a given file.
 java.util.Set<org.eclipse.core.resources.IFile> getDependingFiles(java.net.URI uri)
          Gets all files that somehow depend on a given base namespace.
 java.util.List<org.eclipse.core.resources.IFile> getFiles(java.net.URI uri)
          Gets a List of all files that are known to contain a given URI.
 java.util.Set<java.net.URI> getImportedURIs(org.eclipse.core.resources.IFile file)
          Assuming an IFile has been scanned, this method returns the owl:imports that that have been found in it.
 java.util.Set<org.eclipse.core.resources.IFile> getImportingFiles(java.net.URI uri)
           
 java.util.List<java.lang.String> getModelFileExtensions()
           
 org.eclipse.core.resources.IFile getPreferredFile(java.net.URI uri)
           
 java.lang.String getSuitableFileName(java.net.URI uri)
           
 void init()
          Serves as a constructor - initializes the internal state based on the IWorkspace defined by ResourcesPlugin.getWorkspace().
 boolean isModelFile(org.eclipse.core.resources.IFile file)
          Checks if a given file should be scanned for a base URI for possible inclusion in the registry.
 boolean isModelFileExtension(java.lang.String extension)
          Checks if a given extension is among the usual extensions for model files, i.e.
 java.util.Iterator<org.eclipse.core.resources.IFile> listFiles()
          Lists all files that are currently known to the registry.
 void refresh(org.eclipse.core.resources.IFile file)
          Refreshes an IFile with the latest base URI from the file.
 void register(org.eclipse.core.resources.IFile file, java.net.URI uri)
           
 void setBaseURI(org.eclipse.core.resources.IFile file, java.net.URI oldURI, java.net.URI newURI)
           
 

Method Detail

getBaseURI

java.net.URI getBaseURI(org.eclipse.core.resources.IFile file)
Gets the base URI that is known to be represented by a given file.

Parameters:
file - the file to test
Returns:
the base URI of file (if known)

getFiles

java.util.List<org.eclipse.core.resources.IFile> getFiles(java.net.URI uri)
Gets a List of all files that are known to contain a given URI.

Parameters:
uri - the URI to get the files for
Returns:
a List of IFiles, with the most suitable match in the beginning

getDependingFiles

java.util.Set<org.eclipse.core.resources.IFile> getDependingFiles(java.net.URI uri)
Gets all files that somehow depend on a given base namespace. This includes the files that directly or indirectly import the URI.

Parameters:
uri - the base URI
Returns:
a Set of registered IFiles

getImportedURIs

java.util.Set<java.net.URI> getImportedURIs(org.eclipse.core.resources.IFile file)
Assuming an IFile has been scanned, this method returns the owl:imports that that have been found in it. If the file has already been opened into memory, then the values from the actual model are taken.

Parameters:
file - the file to get the imported URIs from
Returns:
a Set of URIs

getImportingFiles

java.util.Set<org.eclipse.core.resources.IFile> getImportingFiles(java.net.URI uri)

getModelFileExtensions

java.util.List<java.lang.String> getModelFileExtensions()

getPreferredFile

org.eclipse.core.resources.IFile getPreferredFile(java.net.URI uri)

getSuitableFileName

java.lang.String getSuitableFileName(java.net.URI uri)

init

void init()
Serves as a constructor - initializes the internal state based on the IWorkspace defined by ResourcesPlugin.getWorkspace().


isModelFile

boolean isModelFile(org.eclipse.core.resources.IFile file)
Checks if a given file should be scanned for a base URI for possible inclusion in the registry. This will call the helper method isModelFileExtension() if the given file has an extension, otherwise return false.

Parameters:
file - the file to test
Returns:
true if file should be scanned
See Also:
isModelFileExtension(String)

isModelFileExtension

boolean isModelFileExtension(java.lang.String extension)
Checks if a given extension is among the usual extensions for model files, i.e. "owl", "rdf" or "rdfs".

Parameters:
extension - the extension to check (not null)
Returns:
true iff the extension is among the model extensions

listFiles

java.util.Iterator<org.eclipse.core.resources.IFile> listFiles()
Lists all files that are currently known to the registry.

Returns:
an Iterator of IFiles

refresh

void refresh(org.eclipse.core.resources.IFile file)
Refreshes an IFile with the latest base URI from the file.

Parameters:
file - the file to refresh

register

void register(org.eclipse.core.resources.IFile file,
              java.net.URI uri)

setBaseURI

void setBaseURI(org.eclipse.core.resources.IFile file,
                java.net.URI oldURI,
                java.net.URI newURI)