org.openide.loaders
Class MultiFileLoader

java.lang.Object
  |
  +--org.openide.util.SharedClassObject
        |
        +--org.openide.loaders.DataLoader
              |
              +--org.openide.loaders.MultiFileLoader
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
UniFileLoader

public abstract class MultiFileLoader
extends DataLoader

Loader for any kind of MultiDataObject. It provides support for recognition of a composite data object and registering entries into it.

See Also:
Serialized Form

Inner classes inherited from class org.openide.loaders.DataLoader
DataLoader.RecognizedFiles
 
Fields inherited from class org.openide.loaders.DataLoader
PROP_ACTIONS, PROP_DISPLAY_NAME
 
Constructor Summary
protected MultiFileLoader(Class representationClass)
          Creates new multi file loader.
protected MultiFileLoader(String representationClassName)
          Creates new multi file loader.
 
Method Summary
protected abstract  MultiDataObject createMultiObject(FileObject primaryFile)
          Creates the right data object for a given primary file.
protected abstract  MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile)
          Creates the right primary entry for a given primary file.
protected abstract  MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj, FileObject secondaryFile)
          Creates a new secondary entry for a given file.
protected abstract  FileObject findPrimaryFile(FileObject fo)
          For a given file finds the primary file.
protected  DataObject handleFindDataObject(FileObject fo, DataLoader.RecognizedFiles recognized)
          Find a data object appropriate to the given file object (as implemented in subclasses).
 
Methods inherited from class org.openide.loaders.DataLoader
clearSharedData, defaultActions, defaultDisplayName, findDataObject, getActions, getDisplayName, getLoader, getRepresentationClass, markFile, readExternal, setActions, setDisplayName, writeExternal
 
Methods inherited from class org.openide.util.SharedClassObject
addNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, initialize, putProperty, putProperty, removeNotify, removePropertyChangeListener, writeReplace
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiFileLoader

protected MultiFileLoader(Class representationClass)
Creates new multi file loader.
Parameters:
representationClass - the representation class

MultiFileLoader

protected MultiFileLoader(String representationClassName)
Creates new multi file loader.
Parameters:
representationClassName - the fully qualified name of the representation class.
Since:
1.10
Method Detail

handleFindDataObject

protected final DataObject handleFindDataObject(FileObject fo,
                                                DataLoader.RecognizedFiles recognized)
                                         throws IOException
Description copied from class: DataLoader
Find a data object appropriate to the given file object (as implemented in subclasses).
Overrides:
handleFindDataObject in class DataLoader
Following copied from class: org.openide.loaders.DataLoader
Parameters:
fo - file object to recognize
recognized - recognized file buffer
Returns:
the data object or null
Throws:
DataObjectExistsException - as in #findDataObject
IOException - as in #findDataObject
See Also:
DataLoader.findDataObject(org.openide.filesystems.FileObject, org.openide.loaders.DataLoader.RecognizedFiles)

findPrimaryFile

protected abstract FileObject findPrimaryFile(FileObject fo)
For a given file finds the primary file.
Parameters:
fo - the (secondary) file
Returns:
the primary file for the file or null if the file is not recognized by this loader

createMultiObject

protected abstract MultiDataObject createMultiObject(FileObject primaryFile)
                                              throws DataObjectExistsException,
                                                     IOException
Creates the right data object for a given primary file. It is guaranteed that the provided file will actually be the primary file returned by findPrimaryFile(org.openide.filesystems.FileObject).
Parameters:
primaryFile - the primary file
Returns:
the data object for this file
Throws:
DataObjectExistsException - if the primary file already has a data object

createPrimaryEntry

protected abstract MultiDataObject.Entry createPrimaryEntry(MultiDataObject obj,
                                                            FileObject primaryFile)
Creates the right primary entry for a given primary file.
Parameters:
obj - requesting object
primaryFile - primary file recognized by this loader
Returns:
primary entry for that file

createSecondaryEntry

protected abstract MultiDataObject.Entry createSecondaryEntry(MultiDataObject obj,
                                                              FileObject secondaryFile)
Creates a new secondary entry for a given file. Note that separate entries must be created for every secondary file within a given multi-file data object.
Parameters:
obj - requesting object
secondaryFile - a secondary file
Returns:
the entry


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.