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
Class StoreProperties

    java.lang.Object
      org.modeshape.connector.filesystem.BasePropertiesFactory
          org.modeshape.connector.filesystem.StoreProperties

All Implemented Interfaces:
  Serializable, CustomPropertiesFactory

    public class StoreProperties

extends BasePropertiesFactory

A `CustomPropertiesFactory` implementation that stores "extra" or "custom" properties for 'nt:file', 'nt:folder', and 'nt:resource' nodes in a separate file that is named the same as the original but with a different extension.

See Also:
  Serialized Form

Field Summary
`static String` | `DEFAULT_EXTENSION`
`static String` | `DEFAULT_RESOURCE_EXTENSION`
`protected static Map<Name,Property>` | `NO_PROPERTIES_MAP`
`protected static Pattern` | `PROPERTY_PATTERN`
`protected static String` | `PROPERTY_PATTERN_STRING` The regex pattern string used to parse properties.
`protected static Pattern` | `STRING_VALUE_PATTERN`
`protected static String` | `STRING_VALUE_PATTERN_STRING` The regex pattern string used to parse quoted string property values.
`protected static Pattern` | `VALUE_PATTERN`
`protected static String` | `VALUE_PATTERN_STRING` The regex pattern string used to parse non-string property values (including hexadecimal-encoded binary values).

Fields inherited from class org.modeshape.connector.filesystem.BasePropertiesFactory
`NO_NAMES, NO_PROPERTIES_COLLECTION, STANDARD_PROPERTIES_FOR_CONTENT, STANDARD_PROPERTIES_FOR_FILE_OR_FOLDER`

Constructor Summary
`StoreProperties()`

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".
`FilenameFilter` | `getFilenameFilter(FilenameFilter exclusionFilter)` Create a filename filter that will ignore any files needed by this implementation.
`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.
`String` | `getSourceName()`
`protected Map<Name,Property>` | `load(File propertiesFile, ExecutionContext context)`
`protected Property` | `parse(String line, ValueFactories factories, PropertyFactory propFactory, NamespaceRegistry namespaces, Map<Name,Property> result)`
`protected File` | `propertiesFileFor(File fileOrDirectory)`
`protected File` | `propertiesFileForResource(File fileOrDirectory)`
`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.
`void` | `setSourceName(String sourceName)`
`protected Set<Name>` | `write(File propertiesFile, ExecutionContext context, Map<Name,Property> properties)`
`protected void` | `write(Property property, Writer stream, ValueFactory<String> strings)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROPERTY_PATTERN_STRING

    protected static final String PROPERTY_PATTERN_STRING

  The regex pattern string used to parse properties. The capture groups are as follows:
  1. property name (encoded)
  2. property type string
  3. a '[' if the value is multi-valued
  4. the single value, or comma-separated values

  The expression is: `([\S]+)\s*[(](\w+)[)]\s*([\[]?)?([^\]]+)[\]]?`

  See Also:
    Constant Field Values

### PROPERTY_PATTERN

    protected static final Pattern PROPERTY_PATTERN

### STRING_VALUE_PATTERN_STRING

    protected static final String STRING_VALUE_PATTERN_STRING

  The regex pattern string used to parse quoted string property values. This is a repeating expression, and group(0) captures the characters within the quotes (including escaped double quotes).

  The expression is: `\"((((?<=\\)\")|[^"])*)\"`

  See Also:
    Constant Field Values

### STRING_VALUE_PATTERN

    protected static final Pattern STRING_VALUE_PATTERN

### VALUE_PATTERN_STRING

    protected static final String VALUE_PATTERN_STRING

  The regex pattern string used to parse non-string property values (including hexadecimal-encoded binary values). This is a repeating expression, and group(1) captures the individual values.

  The expression is: `([^\s,]+)\s*[,]*\s*`

  See Also:
    Constant Field Values

### VALUE_PATTERN

    protected static final Pattern VALUE_PATTERN

### DEFAULT_EXTENSION

    public static final String DEFAULT_EXTENSION

See Also:
  Constant Field Values

### DEFAULT_RESOURCE_EXTENSION

    public static final String DEFAULT_RESOURCE_EXTENSION

See Also:
  Constant Field Values

### NO_PROPERTIES_MAP

    protected static final Map<Name,Property> NO_PROPERTIES_MAP

Constructor Detail

### StoreProperties

    public StoreProperties()

Method Detail

### getFilenameFilter

    public FilenameFilter getFilenameFilter(FilenameFilter exclusionFilter)

  Description copied from class: `BasePropertiesFactory`
  Create a filename filter that will ignore any files needed by this implementation.

  Overrides:
    `getFilenameFilter` in class `BasePropertiesFactory`
  Parameters:
    `exclusionFilter` - the default filter, which should be included; may be null if there is no such filter
  Returns:
    the filter

### getSourceName

    public String getSourceName()

  Returns:
    sourceName

### setSourceName

    public void setSourceName(String sourceName)

  Parameters:
    `sourceName` - Sets sourceName to the specified value.

### getDirectoryProperties

    public 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
  See Also:
    `CustomPropertiesFactory.getDirectoryProperties(org.modeshape.graph.ExecutionContext, org.modeshape.graph.Location, java.io.File)`

### getFileProperties

    public 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
  See Also:
    `CustomPropertiesFactory.getFileProperties(org.modeshape.graph.ExecutionContext, org.modeshape.graph.Location, java.io.File)`

### getResourceProperties

    public 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
  See Also:
    `CustomPropertiesFactory.getResourceProperties(org.modeshape.graph.ExecutionContext, org.modeshape.graph.Location, java.io.File, java.lang.String)`

### recordDirectoryProperties

    public 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
  See Also:
    `CustomPropertiesFactory.recordDirectoryProperties(org.modeshape.graph.ExecutionContext, java.lang.String, org.modeshape.graph.Location, java.io.File, java.util.Map)`

### recordFileProperties

    public 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
  See Also:
    `CustomPropertiesFactory.recordFileProperties(org.modeshape.graph.ExecutionContext, java.lang.String, org.modeshape.graph.Location, java.io.File, java.util.Map)`

### recordResourceProperties

    public 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
  See Also:
    `CustomPropertiesFactory.recordResourceProperties(org.modeshape.graph.ExecutionContext, java.lang.String, org.modeshape.graph.Location, java.io.File, java.util.Map)`

### propertiesFileFor

    protected File propertiesFileFor(File fileOrDirectory)

### propertiesFileForResource

    protected File propertiesFileForResource(File fileOrDirectory)

### load

    protected Map<Name,Property> load(File propertiesFile,
                                      ExecutionContext context)
                               throws RepositorySourceException

  Throws:
    `RepositorySourceException`

### write

    protected Set<Name> write(File propertiesFile,
                              ExecutionContext context,
                              Map<Name,Property> properties)
                       throws RepositorySourceException

  Throws:
    `RepositorySourceException`

### write

    protected void write(Property property,
                         Writer stream,
                         ValueFactory<String> strings)
                  throws IOException

  Throws:
    `IOException`

### parse

    protected Property parse(String line,
                             ValueFactories factories,
                             PropertyFactory propFactory,
                             NamespaceRegistry namespaces,
                             Map<Name,Property> result)

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-2011 JBoss, a division of Red Hat. All Rights Reserved.