com.bbn.swede.core.libraries
Interface ILibraryDescriptor

All Known Implementing Classes:
LibraryDescriptor

public interface ILibraryDescriptor

Classes which implement this interface correspond to handles for manipulation of SWeDE libraries. They are the API interface for all operations on libraries. ILibraryDescriptors also have an IConfiguration object which manages their configuration.

Author:
aperezlo

Method Summary
 void addEntry(ILibraryEntryDescriptor iled)
          Add a new entry to this library descriptor's library.
 void addLibraryChangeListener(ILibraryChangeListener lcl)
          Registers an object for notifications of changes to this library.
 boolean close()
          Releases any system resources associated with the ILibrary that are held by this ILibraryDescriptor.
 boolean contains(String fileName)
          Checks whether this library contains a particular file.
 boolean containsURI(String sUri)
          Checks whether this library contains a file with a particular base URI.
 ILibraryEntryDescriptor createEntry(File file, Properties props, IOWLAbstractSyntaxTree oast)
          This method will create a new ILibraryEntry and add it to this object's ILibrary, and return the descriptor associated with the 'Entry.
 void delete()
          Called when a library is deleted.
 IStatus edit(LibraryEdit edit, IProgressMonitor progress)
          Performs an edit operation, encapsulated in the LibraryEdit object upon this library and its descriptor.
 IStatus export(IPath exportPath, ILibraryEntryDescriptor iled, IProgressMonitor progress)
          This method provides a way to export an entry of a library to a particular directory, represented by the exportPath parameter.
 IConfiguration getConfiguration()
          Retrieves the configuration object for this descriptor.
 ILibraryEntryDescriptor getDescriptorFor(String fileName)
          Retrieves the entry descriptor for a particular file within the library.
 ILibraryEntryDescriptor getDescriptorForURI(String sUri)
          Retrieves the entry descriptor for a particular URI within this library.
 List getEntryDescriptors()
          Retrieves the descriptors for all entries in this library.
 ILibrary getLibrary()
          Retrieves the ILibrary with which this descriptor is associated.
 String getName()
          Retrieves the name of the library represented by this descriptor.
 boolean isAvailable()
          Returns true if this library is available for operations, and false otherwise.
 boolean open()
          Attempts to reserve system resources required for the proper operation of this ILibraryDescriptor's library.
 IStatus refresh(IProgressMonitor progress)
          Re-downloads each of the documents in the library which are marked for automatic update and rebuilds the library with the updated sources.
 void removeEntry(ILibraryEntryDescriptor iled)
          Removes a library entry from this library.
 void removeLibraryChangeListener(ILibraryChangeListener lcl)
          Unregisters an object from notifications of changes to this library.
 void setLibrary(Library l)
          Associates this descriptor with a new library.
 void writeLibrary()
          Writes the library to disk in the default library location.
 void writeLibrary(String path)
          Writes the library to disk in the specified path.
 

Method Detail

getLibrary

public ILibrary getLibrary()
Retrieves the ILibrary with which this descriptor is associated.

Returns:
the associated library

getName

public String getName()
Retrieves the name of the library represented by this descriptor.

Returns:
The library name

open

public boolean open()
Attempts to reserve system resources required for the proper operation of this ILibraryDescriptor's library.

Returns:
true if the library was successfully opened, false otherwise

export

public IStatus export(IPath exportPath,
                      ILibraryEntryDescriptor iled,
                      IProgressMonitor progress)
This method provides a way to export an entry of a library to a particular directory, represented by the exportPath parameter. The iled represents the entry of the library that should be exported, optionally with the entry's associated metadata.

Parameters:
exportPath - the path to which the desired entry should be exported
iled - the entry to be exported
progress - an object which should be notified of the progress of this operation
Returns:
IStatus.OK if the operation was a success, IStatus.CANCEL if it was canceled, IStatus.ERROR otherwise.

isAvailable

public boolean isAvailable()
Returns true if this library is available for operations, and false otherwise. Some examples of times when a library would be unavailable for operations include if the library is currently in the process of being written to disk, or if the library is being refreshed.

Returns:
true if this library is available for operations, false otherwise

delete

public void delete()
Called when a library is deleted.


addEntry

public void addEntry(ILibraryEntryDescriptor iled)
Add a new entry to this library descriptor's library. This is a temporary add and will not be permanent until the library is written to disk using either writeLibrary() or writeLibrary(String).

Parameters:
iled - the ILibraryEntryDescriptor representing the entry to be added to this library descriptor's library

removeEntry

public void removeEntry(ILibraryEntryDescriptor iled)
Removes a library entry from this library. This change is not permanent until the library is written to disk using either writeLibrary() or writeLibrary(String).

Parameters:
iled - The entry top remove

setLibrary

public void setLibrary(Library l)
Associates this descriptor with a new library.

Parameters:
l - the new library

createEntry

public ILibraryEntryDescriptor createEntry(File file,
                                           Properties props,
                                           IOWLAbstractSyntaxTree oast)
This method will create a new ILibraryEntry and add it to this object's ILibrary, and return the descriptor associated with the 'Entry.

Parameters:
file - the file representing the document to be added to the library
props - a set of properties holding metadata about the file
oast - a serialized version of the IOWLAbstractSyntaxTree associated with this ontology, or null
Returns:
a ILibraryEntryDescriptor that is associated witht the entry just created

getConfiguration

public IConfiguration getConfiguration()
Retrieves the configuration object for this descriptor.

Returns:
this descriptor's IConfiguration object.

writeLibrary

public void writeLibrary()
Writes the library to disk in the default library location.


writeLibrary

public void writeLibrary(String path)
Writes the library to disk in the specified path.

Parameters:
path - a String representing a location on disk

close

public boolean close()
Releases any system resources associated with the ILibrary that are held by this ILibraryDescriptor.

Returns:
true if there were no exceptions generated during this operation, false otherwise

getEntryDescriptors

public List getEntryDescriptors()
Retrieves the descriptors for all entries in this library.

Returns:
a List of ILibraryEntryDescriptor objects for the entries in this library

contains

public boolean contains(String fileName)
Checks whether this library contains a particular file.

Parameters:
fileName - the file name
Returns:
true if there is a ILibraryEntryDescriptor that matches fileName, false if not.

getDescriptorFor

public ILibraryEntryDescriptor getDescriptorFor(String fileName)
Retrieves the entry descriptor for a particular file within the library.

Parameters:
fileName - the file name of the desired entry
Returns:
the ILibraryEntryDescriptor associated with fileName, or null if one cannot be found

containsURI

public boolean containsURI(String sUri)
Checks whether this library contains a file with a particular base URI.

Parameters:
sUri - The desired base URI
Returns:
true if a document contained in this library has the specified base URI, false otherwise

addLibraryChangeListener

public void addLibraryChangeListener(ILibraryChangeListener lcl)
Registers an object for notifications of changes to this library.

Parameters:
lcl - The listener to register. If lcl is already registered as a change listener for this library, this method has no effect.

removeLibraryChangeListener

public void removeLibraryChangeListener(ILibraryChangeListener lcl)
Unregisters an object from notifications of changes to this library.

Parameters:
lcl - The listener to unregister. If lcl is not registered as a change listener for this library, this method has no effect.

getDescriptorForURI

public ILibraryEntryDescriptor getDescriptorForURI(String sUri)
Retrieves the entry descriptor for a particular URI within this library.

Parameters:
sUri - The base URI of the desired entry
Returns:
the ILibraryEntryDescriptor associated with sUri, or null if a matching entry cannot be found

refresh

public IStatus refresh(IProgressMonitor progress)
Re-downloads each of the documents in the library which are marked for automatic update and rebuilds the library with the updated sources.

Parameters:
progress - a progress monitor
Returns:
an IStatus object representing the result of the refresh operation attempt

edit

public IStatus edit(LibraryEdit edit,
                    IProgressMonitor progress)
Performs an edit operation, encapsulated in the LibraryEdit object upon this library and its descriptor.

Parameters:
edit - the edit operation
progress - an object to be notified of the progress of this operation
Returns:
IStatus.OK if the operation was a success, IStatus.CANCEL if it was canceled, or IStatus.ERROR otherwise


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.