Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.connector.filesystem
Interface CustomPropertiesFactory

All Superinterfaces:
  Serializable

All Known Implementing Classes:
  BasePropertiesFactory, IgnoreProperties, LogProperties, StoreProperties, ThrowProperties

    @Immutable
    public interface CustomPropertiesFactory

extends Serializable

A simple interface that allows an implementer to define additional properties for "nt:folder", "nt:file", and "nt:resource" nodes created by the file system connector.

To use, supply the implementation to a `FileSystemSource` object (or register the factory in a subclass of FileSystemSource). Implementations should be immutable because they are shared between all the connections.

Method Summary
`Collection<Property>` | `getDirectoryProperties(ExecutionContext context, Location location, File directory)` Construct the custom properties that should be created for the supplied directory that is to be treated as an "nt:folder".
`Collection<Property>` | `getFileProperties(ExecutionContext context, Location location, File file)` Construct the custom properties that should be created for the supplied file that is to be treated as an "nt:file".
`Collection<Property>` | `getResourceProperties(ExecutionContext context, Location location, File file, String mimeType)` Construct the custom properties that should be created for the supplied file that is to be treated as an "nt:resource", which is the node that contains the content-oriented properties and that is a child of a "nt:file" node.
`Set<Name>` | `recordDirectoryProperties(ExecutionContext context, String sourceName, Location location, File file, Map<Name,Property> properties)` Record the supplied properties as being set on the designated "nt:folder" node.
`Set<Name>` | `recordFileProperties(ExecutionContext context, String sourceName, Location location, File file, Map<Name,Property> properties)` Record the supplied properties as being set on the designated "nt:file" node.
`Set<Name>` | `recordResourceProperties(ExecutionContext context, String sourceName, Location location, File file, Map<Name,Property> properties)` Record the supplied properties as being set on the designated "nt:resource" node.

Method Detail

### getDirectoryProperties

    Collection<Property> getDirectoryProperties(ExecutionContext context,
                                                Location location,
                                                File directory)

  Construct the custom properties that should be created for the supplied directory that is to be treated as an "nt:folder". The resulting properties should not include the standard `JcrLexicon.PRIMARY_TYPE` or `JcrLexicon.CREATED` properties, which are set automatically and will override any returned Property with the same name.

  Parameters:
    `context` - the execution context; never null
    `location` - the Location of the node, which always contains a `path`; never null
    `directory` - the file system object; never null and `File.isDirectory()` will always return true
  Returns:
    the custom properties; never null but possibly empty

### getResourceProperties

    Collection<Property> getResourceProperties(ExecutionContext context,
                                               Location location,
                                               File file,
                                               String mimeType)

  Construct the custom properties that should be created for the supplied file that is to be treated as an "nt:resource", which is the node that contains the content-oriented properties and that is a child of a "nt:file" node. The resulting properties should not include the standard `JcrLexicon.PRIMARY_TYPE`, `JcrLexicon.LAST_MODIFIED`, or `JcrLexicon.DATA` properties, which are set automatically and will override any returned Property with the same name.

  Parameters:
    `context` - the execution context; never null
    `location` - the Location of the node, which always contains a `path`; never null
    `file` - the file system object; never null and `File.isFile()` will always return true
    `mimeType` - the mime type for the file, as determined by the `MIME type detector`, or null if the MIME type could not be determined
  Returns:
    the custom properties; never null but possibly empty

### getFileProperties

    Collection<Property> getFileProperties(ExecutionContext context,
                                           Location location,
                                           File file)

  Construct the custom properties that should be created for the supplied file that is to be treated as an "nt:file". The resulting properties should not include the standard `JcrLexicon.PRIMARY_TYPE` or `JcrLexicon.CREATED` properties, which are set automatically and will override any returned Property with the same name.

  Although the connector does not automatically determine the MIME type for the "nt:file" nodes, an implementation can determine the MIME type by using the context's `MIME type detector`. Note, however, that this may be an expensive operation, so it should be used only when needed.

  Parameters:
    `context` - the execution context; never null
    `location` - the Location of the node, which always contains a `path`; never null
    `file` - the file system object; never null and `File.isFile()` will always return true
  Returns:
    the custom properties; never null but possibly empty

### recordDirectoryProperties

    Set<Name> recordDirectoryProperties(ExecutionContext context,
                                        String sourceName,
                                        Location location,
                                        File file,
                                        Map<Name,Property> properties)
                                        throws RepositorySourceException

  Record the supplied properties as being set on the designated "nt:folder" node.

  Parameters:
    `context` - the execution context; never null
    `sourceName` - the name of the repository source; never null
    `location` - the Location of the node, which always contains a `path`; never null
    `file` - the file system object; never null, and both `File.exists()` and `File.isDirectory()` will always return true
    `properties` - the properties that are to be set
  Returns:
    the names of the properties that were created, or an empty or null set if no properties were created on the file
  Throws:
    `RepositorySourceException` - if any properties are invalid or cannot be set on these nodes

### recordFileProperties

    Set<Name> recordFileProperties(ExecutionContext context,
                                   String sourceName,
                                   Location location,
                                   File file,
                                   Map<Name,Property> properties)
                                   throws RepositorySourceException

  Record the supplied properties as being set on the designated "nt:file" node.

  Parameters:
    `context` - the execution context; never null
    `sourceName` - the name of the repository source; never null
    `location` - the Location of the node, which always contains a `path`; never null
    `file` - the file system object; never null, and both `File.exists()` and `File.isFile()` will always return true
    `properties` - the properties that are to be set
  Returns:
    the names of the properties that were created, or an empty or null set if no properties were created on the file
  Throws:
    `RepositorySourceException` - if any properties are invalid or cannot be set on these nodes

### recordResourceProperties

    Set<Name> recordResourceProperties(ExecutionContext context,
                                       String sourceName,
                                       Location location,
                                       File file,
                                       Map<Name,Property> properties)
                                       throws RepositorySourceException

  Record the supplied properties as being set on the designated "nt:resource" node.

  Parameters:
    `context` - the execution context; never null
    `sourceName` - the name of the repository source; never null
    `location` - the Location of the node, which always contains a `path`; never null
    `file` - the file system object; never null, and both `File.exists()` and `File.isFile()` will always return true
    `properties` - the properties that are to be set
  Returns:
    the names of the properties that were created, or an empty or null set if no properties were created on the file
  Throws:
    `RepositorySourceException` - if any properties are invalid or cannot be set on these nodes

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.