com.bbn.swede.core.libraries
Class LibraryStructuralEdit

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

public class LibraryStructuralEdit
extends Object

Represents the addition or deletion of a file from a library. This class can also perform metadata updates for both library entries and the library itself.

As defined in LibraryEdit, there are 4 possible types of edits, identified by the constants in that class LibraryEdit.ADDITION, LibraryEdit.DELETION, LibraryEdit.REFRESH, and LibraryEdit.CONFIGURATION. Additionally, the modifier LibraryEdit.LIBRARY_LEVEL can be combined with LibraryEdit.CONFIGURATION with a logical OR to set library-level metadata.

Depending on which type of operation is desired, different constructors should be called, and different parameters to those constructors are allowed to be null.

Author:
aperezlo

Constructor Summary
  LibraryStructuralEdit(File file, String name, int type)
          Creates a library edit with a specified name and type.
  LibraryStructuralEdit(IConfiguration config, int type)
          Creates a library edit for the specified configuration and type.
protected LibraryStructuralEdit(String name, int type)
          Creates a library edit with a specified name and type.
  LibraryStructuralEdit(URL file, String name, int type)
          Creates a library edit for a URL within the library.
 
Method Summary
 IStatus configure(ILibraryDescriptor ild, IProgressMonitor progress)
          Performs a configuration operation, either on a library or a library entry.
 String getName()
          Retrieves the name of the resource to which this edit applies.
 int getType()
          Retrieves the type of this edit.
 IStatus perform(File directory, IProgressMonitor progress)
          Performs an addition, deletion or refresh operation on a library entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LibraryStructuralEdit

protected LibraryStructuralEdit(String name,
                                int type)
Creates a library edit with a specified name and type.

Parameters:
name - The name
type - The type. See LibraryEdit for edit type constants.

LibraryStructuralEdit

public LibraryStructuralEdit(URL file,
                             String name,
                             int type)
Creates a library edit for a URL within the library. This constructor should be used to create edits of type LibraryEdit.REFRESH, LibraryEdit.ADDITION, or LibraryEdit.DELETION.

Parameters:
file - The source URL of the entry to edit
name - The name
type - The type. See LibraryEdit for edit type constants.

LibraryStructuralEdit

public LibraryStructuralEdit(File file,
                             String name,
                             int type)
Creates a library edit with a specified name and type.

Parameters:
file - The file to edit
name - The name
type - The type. See LibraryEdit for edit type constants.

LibraryStructuralEdit

public LibraryStructuralEdit(IConfiguration config,
                             int type)
Creates a library edit for the specified configuration and type. This constructor should be used for edits of type LibraryEdit.CONFIGURATION and LibraryEdit.CONFIGURATION | LibraryEdit.LIBRARY_LEVEL.

Parameters:
config - The configuration
type - The type. See LibraryEdit for edit type constants.
Method Detail

getType

public int getType()
Retrieves the type of this edit.

Returns:
the edit type

getName

public String getName()
Retrieves the name of the resource to which this edit applies.

Returns:
the name of the resource

configure

public IStatus configure(ILibraryDescriptor ild,
                         IProgressMonitor progress)
Performs a configuration operation, either on a library or a library entry. This operation supports cancelation.

Parameters:
ild - the library in which the file to be configured lives, or the library whose metadata should be changed
progress - a progress monitor to be informed of the progress of this operation
Returns:
an IStatus object with code IStatus.OK if a success, and an error otherwise, or Status.CANCEL_STATUS if the operation was canceled

perform

public IStatus perform(File directory,
                       IProgressMonitor progress)
Performs an addition, deletion or refresh operation on a library entry. This operation supports cancelation.

Parameters:
directory - The directory in which the operation should be performed
progress - a progress monitor to be informed of the progress of this operation
Returns:
an IStatus object with code IStatus.OK if a success, and an error otherwise, or Status.CANCEL_STATUS if the operation was canceled


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