com.bbn.swede.core.libraries
Class Libraries

java.lang.Object
  extended bycom.bbn.swede.core.libraries.Libraries

public final class Libraries
extends Object

A singleton class used to gain access to individual ILibraryDescriptor objects.

Author:
aperezlo

Field Summary
static String LIBRARY_DIRECTORY
          Directory name for storing Ontology Libraries.
static String LIBRARY_EXTENSION
          File extension for Ontology Libraries stored on disk.
static String LIBRARY_TEMP_DIRECTORY
          Temp directory for internal library operations.
static String SESSION_PROPERTY_DELIMETER
          Delimeter for storing multiple libraries in one session property.
static String SESSION_PROPERTY_QUALIFIER
          Identifier for storing library references as a session property.
 
Method Summary
static boolean createLibrary(String name)
          Creates a new empty library with the specified name.
static boolean deleteLibrary(ILibraryDescriptor ild)
          Attempts to delete a library from the system.
static List getAllLibraries()
          Retrieves the descriptors of all Ontology Libraries.
static ILibraryDescriptor getLibrary(String libraryName)
          Returns the ILibraryDescriptor associated with a particular library name.
static String getLibraryEditPath(String libraryName)
          Retrieves a temporary path that can be used to edit a specific library.
static String getLibraryLocationPath()
          Retrieves the location on disk of the library directory.
static String getLibraryTempLocationPath()
          Retrieves the location on disk of the library temp directory.
static boolean isDueForRefresh(ILibraryDescriptor ild)
          Determines whether a library is due to be refreshed or not.
static void refreshAllLibraries()
          Used to refresh all libraries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIBRARY_EXTENSION

public static final String LIBRARY_EXTENSION
File extension for Ontology Libraries stored on disk.

See Also:
Constant Field Values

LIBRARY_DIRECTORY

public static final String LIBRARY_DIRECTORY
Directory name for storing Ontology Libraries. This directory will exist directly underneath the Eclipse workspace.

See Also:
Constant Field Values

LIBRARY_TEMP_DIRECTORY

public static final String LIBRARY_TEMP_DIRECTORY
Temp directory for internal library operations.

See Also:
Constant Field Values

SESSION_PROPERTY_QUALIFIER

public static final String SESSION_PROPERTY_QUALIFIER
Identifier for storing library references as a session property.

See Also:
Constant Field Values

SESSION_PROPERTY_DELIMETER

public static final String SESSION_PROPERTY_DELIMETER
Delimeter for storing multiple libraries in one session property.

See Also:
Constant Field Values
Method Detail

refreshAllLibraries

public static void refreshAllLibraries()
Used to refresh all libraries. This method creates and schedules RefreshLibraryJobs for each library to accomplish the work.


isDueForRefresh

public static boolean isDueForRefresh(ILibraryDescriptor ild)
Determines whether a library is due to be refreshed or not. This is based on three pieces of information - first, whether the automatic update feature is enabled in the Ontology Library preferences page, second, whether the required amount of time since the last refresh (also specified on that preferences page) has elapsed, and finally, whether any of the documents in the specified library are configured to be automatically updated.

Parameters:
ild - an ILibraryDescriptor object
Returns:
true if a library is due to be refreshed, false otherwise

createLibrary

public static boolean createLibrary(String name)
Creates a new empty library with the specified name. Will fail if there already exists a library with that name.

Parameters:
name - the name for the new library - the LIBRARY_EXTENSION will automatically be appended to the library name.
Returns:
true if the new library could be created, false otherwise

getLibraryLocationPath

public static String getLibraryLocationPath()
Retrieves the location on disk of the library directory.

Returns:
the path of the libarary directory, as a string

getLibraryTempLocationPath

public static String getLibraryTempLocationPath()
Retrieves the location on disk of the library temp directory.

Returns:
the path of the library temp directory, as a string.

getLibraryEditPath

public static String getLibraryEditPath(String libraryName)
Retrieves a temporary path that can be used to edit a specific library.

Parameters:
libraryName - the library that is about to undergo an edit
Returns:
a temporary location where edits can occur

getLibrary

public static ILibraryDescriptor getLibrary(String libraryName)
Returns the ILibraryDescriptor associated with a particular library name. If no libraries are presently loaded, this method will attempt to load the libraries in the library directory.

Parameters:
libraryName - the name of the desired library
Returns:
the ILibraryDescriptor representing that library, or null if it cannot be found

deleteLibrary

public static boolean deleteLibrary(ILibraryDescriptor ild)
Attempts to delete a library from the system. This will make it unavailable in the future, and will physically delete the file that holds the library.

Parameters:
ild - the descriptor of the library to delete
Returns:
true if the delete operation was a success, false otherwise

getAllLibraries

public static List getAllLibraries()
Retrieves the descriptors of all Ontology Libraries.

Returns:
a List of all ILibraryDescriptors, one for each library in the system


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