danger.content
Class ContentManager

java.lang.Object
  extended by danger.content.ContentManager


public class ContentManager
extends Object

The main access point for the content management system.


Field Summary
static String FOLDER_TYPE
          The MIME type given to folders.
static String UNKNOWN_TYPE
          The MIME type given to unrecognized files.
 
Method Summary
static void dumpBatchPaths()
          Dump information about paths marked for batch changes.
static void dumpContentListeners()
          Dump information about registered content listeners.
static void dumpHandlers()
          Dump information about registered handlers (recognizers).
static void dumpStoreListeners()
          Dump information about registered store listeners.
static void endBatchChange(String cookie)
          End delayed file notifications for this path.
static void forceUpdate(String path)
          Force the store entry for this path to be updated.
static FileSet getFiles(ContentFilter filter, int[] propertyIDs)
          Get a set of specified properties for all objects matching the given filter.
static FileSet getFiles(int[] propertyIDs)
          Get a set of specified properties for all objects.
static int getIDFromPath(String path)
          Get the ID of the object representing the specified path.
static void registerContentChangeListener(Listener listener)
          Register to receive content change notifications for all content.
static void registerContentChangeListener(Listener listener, ContentFilter filter)
          Register to receive content change notifications, using the provided filter.
static void registerFileHandler(FileHandler handler)
          Register a handler (recognizer) that will provide information about particular types of files.
static void registerStoreStateListener(Listener listener)
          Register a listener to receive store notifications.
static String startBatchChange(String path, int timeout)
          Delay file notifications for this path until a correpsonding endBatchChange(String) call is received, or the timeout is reached.
static void unregisterContentChangeListener(Listener listener)
          Unregister a previously-registered content listener.
static void unregisterFileHandler(FileHandler handler)
          Unregister a previously-registered handler (recognizer).
static void unregisterStoreStateListener(Listener listener)
          Unregister a previously-registered store notification listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_TYPE

public static final String UNKNOWN_TYPE
The MIME type given to unrecognized files.

Since:
4.5
See Also:
Constant Field Values

FOLDER_TYPE

public static final String FOLDER_TYPE
The MIME type given to folders.

Since:
4.5
See Also:
Constant Field Values
Method Detail

registerFileHandler

public static void registerFileHandler(FileHandler handler)
Register a handler (recognizer) that will provide information about particular types of files.

Parameters:
handler - FileHandler to be registered

unregisterFileHandler

public static void unregisterFileHandler(FileHandler handler)
Unregister a previously-registered handler (recognizer).

Parameters:
handler - Previously registered FileHandler to be unregistered.

dumpHandlers

public static void dumpHandlers()
Dump information about registered handlers (recognizers).


registerStoreStateListener

public static void registerStoreStateListener(Listener listener)
Register a listener to receive store notifications. When the store state changes, a EventType.EVENT_STORE_STATE_CHANGED event will be sent along with one of:

Parameters:
listener - Listener to send store notifications to.

unregisterStoreStateListener

public static void unregisterStoreStateListener(Listener listener)
Unregister a previously-registered store notification listener.

Parameters:
listener - Listener to stop sending store notifications to.

dumpStoreListeners

public static void dumpStoreListeners()
Dump information about registered store listeners.


registerContentChangeListener

public static void registerContentChangeListener(Listener listener)
Register to receive content change notifications for all content. If a file changes (or is created/deleted) on the filesystem, this listener will be sent a EventType.EVENT_FILESYSTEM_CONTENTS_CHANGED event along with one of:

Parameters:
listener - Listener to send content change notifications to.
Since:
4.5
See Also:
registerContentChangeListener(Listener, ContentFilter)

registerContentChangeListener

public static void registerContentChangeListener(Listener listener,
                                                 ContentFilter filter)
Register to receive content change notifications, using the provided filter. If a file changes (or is created/deleted) on the filesystem, and it matches the specified filter, this listener will be sent a EventType.EVENT_FILESYSTEM_CONTENTS_CHANGED event along with one of:

Parameters:
listener - Listener to send content change notifications to.
filter - ContentFilter to apply to change notifications before sending.
See Also:
registerContentChangeListener(Listener)

unregisterContentChangeListener

public static void unregisterContentChangeListener(Listener listener)
Unregister a previously-registered content listener.

Parameters:
listener - Listener to stop sending content changed notifications to.

dumpContentListeners

public static void dumpContentListeners()
Dump information about registered content listeners.


getIDFromPath

public static int getIDFromPath(String path)
                         throws StoreException
Get the ID of the object representing the specified path.

Parameters:
path - String containing path to object.
Throws:
StoreException

getFiles

public static FileSet getFiles(int[] propertyIDs)
Get a set of specified properties for all objects.

Parameters:
propertyIDs - array of property IDs to be filtered.
Returns:
FileSet containing all files.
Since:
4.5

getFiles

public static FileSet getFiles(ContentFilter filter,
                               int[] propertyIDs)
Get a set of specified properties for all objects matching the given filter.

Parameters:
filter - ContentFilter to be applied to set of properties.
propertyIDs - array of property IDs to be filtered.
Returns:
FileSet containing files that matched the content filter.

startBatchChange

public static String startBatchChange(String path,
                                      int timeout)
Delay file notifications for this path until a correpsonding endBatchChange(String) call is received, or the timeout is reached. Calls to startBatchChange(String,int) and endBatchChange(String) must be balanced.

Parameters:
path - absolute path on which to delay notifications
timeout - msecs before the system forcefully ends the batch
Returns:
cookie used to identify this batch change

endBatchChange

public static void endBatchChange(String cookie)
End delayed file notifications for this path. Calls to startBatchChange(String,int) and endBatchChange(String) must be balanced.

Parameters:
cookie - String containing cookie used to identify expiration timer.

dumpBatchPaths

public static void dumpBatchPaths()
Dump information about paths marked for batch changes.


forceUpdate

public static void forceUpdate(String path)
Force the store entry for this path to be updated. This shouldn't need to be used under normal operation. This causes the path to be re-scanned and re-identified. This can be useful during testing recognizers (handlers), or if a file has been previously identified incorrectly.

Parameters:
path - String containing path of object to force update on.