org.modeshape.connector.filesystem
Class FileSystemSource

java.lang.Object
  extended by org.modeshape.graph.connector.base.AbstractRepositorySource
      extended by org.modeshape.graph.connector.base.AbstractNodeCachingRepositorySource<Path,PathNode>
          extended by org.modeshape.connector.filesystem.FileSystemSource
All Implemented Interfaces:
Serializable, Referenceable, ObjectFactory, BaseRepositorySource, RepositorySource

@ThreadSafe
public class FileSystemSource
extends AbstractNodeCachingRepositorySource<Path,PathNode>
implements ObjectFactory

The RepositorySource for the connector that exposes an area of the local file system as content in a repository. This source considers a workspace name to be the path to the directory on the file system that represents the root of that workspace. New workspaces can be created, as long as the names represent valid paths to existing directories.

See Also:
Serialized Form

Field Summary
protected static String ALLOW_CREATING_WORKSPACES
           
protected static String CACHE_POLICY
           
protected static String CUSTOM_PROPERTY_FACTORY
           
static boolean DEFAULT_DETERMINE_MIME_TYPE_USING_CONTENT
          This source by default does not use the file content to determine the MIME type, but instead just uses the filename.
static boolean DEFAULT_EAGER_FILE_LOADING
          This source by default does not eagerly read the file content into Binary values, but instead does it only when necessary.
static String DEFAULT_EXCLUSION_PATTERN
           
static String DEFAULT_EXTRA_PROPERTIES
          The default behavior for dealing with extra properties on 'nt:file', 'nt:folder' and 'nt:resource' nodes is to log them.
static FilenameFilter DEFAULT_FILENAME_FILTER
           
static String DEFAULT_INCLUSION_PATTERN
           
static int DEFAULT_MAX_PATH_LENGTH
           
static String DEFAULT_NAME_OF_DEFAULT_WORKSPACE
          The initial name of the default workspace is ""default" ", unless otherwise specified.
protected static boolean DEFAULT_SUPPORTS_CREATING_WORKSPACES
          This source does support creating workspaces.
static boolean DEFAULT_SUPPORTS_UPDATES
          This source does not support updates by default, but each instance may be configured to be read-only or updateable}.
static String DEFAULT_TEMPORARY_STORAGE_PATH
          The default path to the temporary storage area, the default value uses the directory specified by the java.io.tmpdir system property.
protected static String DEFAULT_WORKSPACE
           
protected static String DETERMINE_MIME_TYPE_USING_CONTENT
           
protected static String EAGER_FILE_LOADING
           
protected static String EXCLUSION_PATTERN
           
protected static String EXTRA_PROPERTIES
           
protected static Map<String,CustomPropertiesFactory> EXTRA_PROPERTIES_CLASSNAME_BY_KEY
           
protected static String FILENAME_FILTER
           
protected static String INCLUSION_PATTERN
           
protected static String MAX_PATH_LENGTH
           
protected static String PREDEFINED_WORKSPACE_NAMES
           
protected static String SOURCE_NAME
           
protected static boolean SUPPORTS_EVENTS
          This source supports events.
protected static boolean SUPPORTS_REFERENCES
          This source supports creating references.
protected static boolean SUPPORTS_SAME_NAME_SIBLINGS
          This source supports same-name-siblings.
protected static String TEMPORARY_STORAGE_PATH
           
protected static String WORKSPACE_ROOT
           
 
Fields inherited from class org.modeshape.graph.connector.base.AbstractNodeCachingRepositorySource
DEFAULT_NODE_CACHE_POLICY, NODE_CACHE_POLICY
 
Fields inherited from class org.modeshape.graph.connector.base.AbstractRepositorySource
cachePolicy, DEFAULT_CACHE_POLICY, DEFAULT_RETRY_LIMIT, DEFAULT_ROOT_NODE_UUID, repositoryContext, retryLimit, rootNodeUuid
 
Constructor Summary
FileSystemSource()
           
 
Method Summary
 boolean areUpdatesAllowed()
          Get whether this source allows updates.
 RepositorySourceCapabilities getCapabilities()
          Get the capabilities for this source.
 RepositoryConnection getConnection()
          Get a connection from this source.
 CustomPropertiesFactory getCustomPropertiesFactory()
          Get the factory that is used to create custom properties on "nt:folder", "nt:file", and "nt:resource" nodes.
 String getDefaultWorkspaceName()
          Get the name of the default workspace.
 String getExclusionPattern()
          Get the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored
 String getExtraPropertiesBehavior()
          Get the desired behavior for handling extra properties on "nt:foldeR", "nt:file", and "nt:resource" nodes.
 FilenameFilter getFilenameFilter()
           
 String getInclusionPattern()
          Get the regular expression that, if matched by a file or folder, indicates that the file or folder should be included
 int getMaxPathLength()
          Get the maximum path length (in characters) allowed by the underlying file system
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment)
          
 String[] getPredefinedWorkspaceNames()
          Gets the names of the workspaces that are available when this source is created.
 Reference getReference()
          
 String getTemporaryStoragePath()
          Optional setting that allows administrators to specify a specific location for the file system connector's temporary storage.
 boolean getUpdatesAllowed()
          Get whether this source supports updates.
 String getWorkspaceRootPath()
          Get the relative root directory for the workspaces.
 boolean isContentUsedToDetermineMimeType()
          Get whether this source should use file content (and file name) to determine the MIME type.
 boolean isCreatingWorkspacesAllowed()
          Get whether this source allows workspaces to be created dynamically.
 boolean isEagerFileLoading()
          Optional flag that defines whether the connector should eagerly read file content even before it is needed, guaranteeing access to the content.
 void setContentUsedToDetermineMimeType(boolean contentUsedToDetermineMimeType)
          Set whether this source should use file content (and file name) to determine the MIME type.
 void setCreatingWorkspacesAllowed(boolean allowWorkspaceCreation)
          Set whether this source allows workspaces to be created dynamically.
 void setCustomPropertiesFactory(CustomPropertiesFactory customPropertiesFactory)
          Set the factory that is used to create custom properties on "nt:folder", "nt:file", and "nt:resource" nodes.
 void setCustomPropertiesFactory(String customPropertiesFactoryClassName)
          Set the factory that is used to create custom properties on "nt:folder", "nt:file", and "nt:resource" nodes by specifying the name of a class that implements the CustomPropertiesFactory interface and has a public, no-argument constructor.
 void setDefaultWorkspaceName(String nameOfDefaultWorkspace)
          Set the name of the workspace that should be used when clients don't specify a workspace.
 void setEagerFileLoading(boolean eagerFileLoading)
           
 void setExclusionPattern(String exclusionPattern)
          Sets the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored Only one of FilenameFilter or Inclusion/Exclusion Pattern are used at a given time.
 void setExtraPropertiesBehavior(String behavior)
          Set the desired behavior for handling extra properties on "nt:foldeR", "nt:file", and "nt:resource" nodes.
 void setFilenameFilter(FilenameFilter filenameFilter)
          Sets the filename filter that is used to restrict which content can be accessed by this connector Only one of FilenameFilter or Inclusion/Exclusion Pattern are used at a given time.
 void setFilenameFilter(String filenameFilterClassName)
          Sets the filename filter that is used to restrict which content can be accessed by this connector by specifying the name of a class that implements the FilenameFilter interface and has a public, no-argument constructor.
 void setInclusionPattern(String inclusionPattern)
          Sets the regular expression that, if matched by a file or folder, indicates that the file or folder should be included Only one of FilenameFilter or Inclusion/Exclusion Pattern are used at a given time.
 void setMaxPathLength(int maxPathLength)
          Set the maximum absolute path length supported by this source.
 void setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
          Sets the names of the workspaces that are available when this source is created.
 void setTemporaryStoragePath(String temporaryStoragePath)
          Sets the new value for the temporary storage path.
 void setUpdatesAllowed(boolean allowUpdates)
          Set whether this source allows updates to data within workspaces
 void setWorkspaceRootPath(String workspaceRootPath)
          Sets the relative root directory for workspaces
 
Methods inherited from class org.modeshape.graph.connector.base.AbstractNodeCachingRepositorySource
addNodeCachePolicyChangedListener, addNodeCachePolicyReference, getNodeCachePolicy, removeNodeCachePolicyChangedListener, setNodeCachePolicy
 
Methods inherited from class org.modeshape.graph.connector.base.AbstractRepositorySource
close, getDefaultCachePolicy, getName, getRepositoryContext, getRetryLimit, getRootNodeUuid, getRootNodeUuidObject, initialize, setCachePolicy, setName, setRetryLimit, setRootNodeUuid, setRootNodeUuidObject, valuesFrom
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME_OF_DEFAULT_WORKSPACE

public static final String DEFAULT_NAME_OF_DEFAULT_WORKSPACE
The initial name of the default workspace is ""default" ", unless otherwise specified.

See Also:
Constant Field Values

SOURCE_NAME

protected static final String SOURCE_NAME
See Also:
Constant Field Values

CACHE_POLICY

protected static final String CACHE_POLICY
See Also:
Constant Field Values

DEFAULT_WORKSPACE

protected static final String DEFAULT_WORKSPACE
See Also:
Constant Field Values

WORKSPACE_ROOT

protected static final String WORKSPACE_ROOT
See Also:
Constant Field Values

PREDEFINED_WORKSPACE_NAMES

protected static final String PREDEFINED_WORKSPACE_NAMES
See Also:
Constant Field Values

ALLOW_CREATING_WORKSPACES

protected static final String ALLOW_CREATING_WORKSPACES
See Also:
Constant Field Values

MAX_PATH_LENGTH

protected static final String MAX_PATH_LENGTH
See Also:
Constant Field Values

EXCLUSION_PATTERN

protected static final String EXCLUSION_PATTERN
See Also:
Constant Field Values

INCLUSION_PATTERN

protected static final String INCLUSION_PATTERN
See Also:
Constant Field Values

FILENAME_FILTER

protected static final String FILENAME_FILTER
See Also:
Constant Field Values

CUSTOM_PROPERTY_FACTORY

protected static final String CUSTOM_PROPERTY_FACTORY
See Also:
Constant Field Values

EAGER_FILE_LOADING

protected static final String EAGER_FILE_LOADING
See Also:
Constant Field Values

DETERMINE_MIME_TYPE_USING_CONTENT

protected static final String DETERMINE_MIME_TYPE_USING_CONTENT
See Also:
Constant Field Values

EXTRA_PROPERTIES

protected static final String EXTRA_PROPERTIES
See Also:
Constant Field Values

TEMPORARY_STORAGE_PATH

protected static final String TEMPORARY_STORAGE_PATH
See Also:
Constant Field Values

SUPPORTS_EVENTS

protected static final boolean SUPPORTS_EVENTS
This source supports events.

See Also:
Constant Field Values

SUPPORTS_SAME_NAME_SIBLINGS

protected static final boolean SUPPORTS_SAME_NAME_SIBLINGS
This source supports same-name-siblings.

See Also:
Constant Field Values

DEFAULT_SUPPORTS_CREATING_WORKSPACES

protected static final boolean DEFAULT_SUPPORTS_CREATING_WORKSPACES
This source does support creating workspaces.

See Also:
Constant Field Values

DEFAULT_SUPPORTS_UPDATES

public static final boolean DEFAULT_SUPPORTS_UPDATES
This source does not support updates by default, but each instance may be configured to be read-only or updateable}.

See Also:
Constant Field Values

DEFAULT_EXTRA_PROPERTIES

public static final String DEFAULT_EXTRA_PROPERTIES
The default behavior for dealing with extra properties on 'nt:file', 'nt:folder' and 'nt:resource' nodes is to log them.

See Also:
Constant Field Values

SUPPORTS_REFERENCES

protected static final boolean SUPPORTS_REFERENCES
This source supports creating references.

See Also:
Constant Field Values

DEFAULT_EAGER_FILE_LOADING

public static final boolean DEFAULT_EAGER_FILE_LOADING
This source by default does not eagerly read the file content into Binary values, but instead does it only when necessary.

See Also:
Constant Field Values

DEFAULT_DETERMINE_MIME_TYPE_USING_CONTENT

public static final boolean DEFAULT_DETERMINE_MIME_TYPE_USING_CONTENT
This source by default does not use the file content to determine the MIME type, but instead just uses the filename.

See Also:
Constant Field Values

DEFAULT_TEMPORARY_STORAGE_PATH

public static final String DEFAULT_TEMPORARY_STORAGE_PATH
The default path to the temporary storage area, the default value uses the directory specified by the java.io.tmpdir system property.


DEFAULT_MAX_PATH_LENGTH

public static final int DEFAULT_MAX_PATH_LENGTH
See Also:
Constant Field Values

DEFAULT_EXCLUSION_PATTERN

public static final String DEFAULT_EXCLUSION_PATTERN

DEFAULT_INCLUSION_PATTERN

public static final String DEFAULT_INCLUSION_PATTERN

DEFAULT_FILENAME_FILTER

public static final FilenameFilter DEFAULT_FILENAME_FILTER

EXTRA_PROPERTIES_CLASSNAME_BY_KEY

protected static Map<String,CustomPropertiesFactory> EXTRA_PROPERTIES_CLASSNAME_BY_KEY
Constructor Detail

FileSystemSource

public FileSystemSource()
Method Detail

getCapabilities

public RepositorySourceCapabilities getCapabilities()
Get the capabilities for this source.

Specified by:
getCapabilities in interface RepositorySource
Returns:
the capabilities for this source; never null
See Also:
RepositorySource.getCapabilities()

getUpdatesAllowed

public boolean getUpdatesAllowed()
Get whether this source supports updates.

Returns:
true if this source supports updates, or false if this source only supports reading content.

getWorkspaceRootPath

public String getWorkspaceRootPath()
Get the relative root directory for the workspaces. If this property is set, workspaces can be given as relative paths from this directory and all workspace paths must be ancestors of this path.

Returns:
the root directory for workspaces

setWorkspaceRootPath

public void setWorkspaceRootPath(String workspaceRootPath)
Sets the relative root directory for workspaces

Parameters:
workspaceRootPath - the relative root directory for workspaces. If this value is non-null, all workspace paths will be treated as paths relative to this directory

getExclusionPattern

@Description(i18n=FileSystemI18n.class,
             value="exclusionPatternPropertyDescription")
@Label(i18n=FileSystemI18n.class,
       value="exclusionPatternPropertyLabel")
@Category(i18n=FileSystemI18n.class,
          value="exclusionPatternPropertyCategory")
public String getExclusionPattern()
Get the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored

Returns:
the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored; may be null

setExclusionPattern

public void setExclusionPattern(String exclusionPattern)
Sets the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored

Only one of FilenameFilter or Inclusion/Exclusion Pattern are used at a given time. If FilenameFilter is used, then the inclusion and exclusion patterns are ignored.

Parameters:
exclusionPattern - the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored. If this pattern is null, no files will be excluded.

getInclusionPattern

@Description(i18n=FileSystemI18n.class,
             value="inclusionPatternPropertyDescription")
@Label(i18n=FileSystemI18n.class,
       value="inclusionPatternPropertyLabel")
@Category(i18n=FileSystemI18n.class,
          value="inclusionPatternPropertyCategory")
public String getInclusionPattern()
Get the regular expression that, if matched by a file or folder, indicates that the file or folder should be included

Returns:
the regular expression that, if matched by a file or folder, indicates that the file or folder should be included; may be null

setInclusionPattern

public void setInclusionPattern(String inclusionPattern)
Sets the regular expression that, if matched by a file or folder, indicates that the file or folder should be included

Only one of FilenameFilter or Inclusion/Exclusion Pattern are used at a given time. If FilenameFilter is used, then the inclusion and exclusion patterns are ignored.

Parameters:
inclusionPattern - the regular expression that, if matched by a file or folder, indicates that the file or folder should be ignored. If this pattern is null, no files will be excluded.

getFilenameFilter

public FilenameFilter getFilenameFilter()
Returns:
the (if any) that is used to restrict which content can be accessed by this connector; may be null

setFilenameFilter

public void setFilenameFilter(FilenameFilter filenameFilter)
Sets the filename filter that is used to restrict which content can be accessed by this connector

Only one of FilenameFilter or Inclusion/Exclusion Pattern are used at a given time. If FilenameFilter is used, then the inclusion and exclusion patterns are ignored.

Parameters:
filenameFilter - the filename filter that is used to restrict which content can be accessed by this connector. If this parameter is null, no files will be excluded.

setFilenameFilter

public void setFilenameFilter(String filenameFilterClassName)
                       throws ClassCastException,
                              ClassNotFoundException,
                              IllegalAccessException,
                              InstantiationException
Sets the filename filter that is used to restrict which content can be accessed by this connector by specifying the name of a class that implements the FilenameFilter interface and has a public, no-argument constructor.

Only one of the exclusionPattern and filenameFilter properties may be non-null at any one time. Calling this method automatically sets the exclusionPattern property to null.

Parameters:
filenameFilterClassName - the class name of the filter implementation or null if no filename filter should be used
Throws:
ClassNotFoundException - if the the class for the FilenameFilter implementation cannot be located
IllegalAccessException - if the filename filter class or its nullary constructor is not accessible.
InstantiationException - if the filename filter represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ClassCastException - if the class named by filenameFilterClassName does not implement the FilenameFilter interface

getMaxPathLength

public int getMaxPathLength()
Get the maximum path length (in characters) allowed by the underlying file system

Returns:
the maximum path length (in characters) allowed by the underlying file system

setMaxPathLength

public void setMaxPathLength(int maxPathLength)
Set the maximum absolute path length supported by this source.

The length of any path is calculated relative to the file system root, NOT the repository root. That is, if a workspace foo is mapped to the /tmp/foo/bar directory on the file system, then the path /node1/node2 in the foo workspace has an effective length of 23 for the purposes of the maxPathLength calculation ( /tmp/foo/bar has length 11, /node1/node2 has length 12, 11 + 12 = 23).

Parameters:
maxPathLength - the maximum absolute path length supported by this source; must be non-negative

getDefaultWorkspaceName

public String getDefaultWorkspaceName()
Get the name of the default workspace.

Specified by:
getDefaultWorkspaceName in interface BaseRepositorySource
Returns:
the name of the workspace that should be used by default; never null

setDefaultWorkspaceName

public void setDefaultWorkspaceName(String nameOfDefaultWorkspace)
Set the name of the workspace that should be used when clients don't specify a workspace.

Parameters:
nameOfDefaultWorkspace - the name of the workspace that should be used by default, or null if the default name should be used

getPredefinedWorkspaceNames

public String[] getPredefinedWorkspaceNames()
Gets the names of the workspaces that are available when this source is created. Each workspace name corresponds to a path to a directory on the file system.

Returns:
the names of the workspaces that this source starts with, or null if there are no such workspaces
See Also:
setPredefinedWorkspaceNames(String[]), setCreatingWorkspacesAllowed(boolean)

setPredefinedWorkspaceNames

public void setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
Sets the names of the workspaces that are available when this source is created. Each workspace name corresponds to a path to a directory on the file system.

Parameters:
predefinedWorkspaceNames - the names of the workspaces that this source should start with, or null if there are no such workspaces
See Also:
setCreatingWorkspacesAllowed(boolean), getPredefinedWorkspaceNames()

isCreatingWorkspacesAllowed

public boolean isCreatingWorkspacesAllowed()
Get whether this source allows workspaces to be created dynamically.

Specified by:
isCreatingWorkspacesAllowed in interface BaseRepositorySource
Overrides:
isCreatingWorkspacesAllowed in class AbstractRepositorySource
Returns:
true if this source allows workspaces to be created by clients, or false if the set of workspaces is fixed
See Also:
setPredefinedWorkspaceNames(String[]), getPredefinedWorkspaceNames(), setCreatingWorkspacesAllowed(boolean)

setCreatingWorkspacesAllowed

public void setCreatingWorkspacesAllowed(boolean allowWorkspaceCreation)
Set whether this source allows workspaces to be created dynamically.

Parameters:
allowWorkspaceCreation - true if this source allows workspaces to be created by clients, or false if the set of workspaces is fixed
See Also:
setPredefinedWorkspaceNames(String[]), getPredefinedWorkspaceNames(), isCreatingWorkspacesAllowed()

areUpdatesAllowed

@Description(i18n=FileSystemI18n.class,
             value="updatesAllowedPropertyDescription")
@Label(i18n=FileSystemI18n.class,
       value="updatesAllowedPropertyLabel")
@Category(i18n=FileSystemI18n.class,
          value="updatesAllowedPropertyCategory")
public boolean areUpdatesAllowed()
Get whether this source allows updates.

Specified by:
areUpdatesAllowed in interface BaseRepositorySource
Overrides:
areUpdatesAllowed in class AbstractRepositorySource
Returns:
true if this source allows updates by clients, or false if no updates are allowed
See Also:
setUpdatesAllowed(boolean)

setUpdatesAllowed

public void setUpdatesAllowed(boolean allowUpdates)
Set whether this source allows updates to data within workspaces

Specified by:
setUpdatesAllowed in interface BaseRepositorySource
Parameters:
allowUpdates - true if this source allows updates to data within workspaces clients, or false if updates are not allowed.
See Also:
areUpdatesAllowed()

isContentUsedToDetermineMimeType

public boolean isContentUsedToDetermineMimeType()
Get whether this source should use file content (and file name) to determine the MIME type.

Returns:
true if the file content should be used to determine the MIME type, or false if only the filename should be used

setContentUsedToDetermineMimeType

public void setContentUsedToDetermineMimeType(boolean contentUsedToDetermineMimeType)
Set whether this source should use file content (and file name) to determine the MIME type.

Parameters:
contentUsedToDetermineMimeType - true if the file content should be used to determine the MIME type

getExtraPropertiesBehavior

public String getExtraPropertiesBehavior()
Get the desired behavior for handling extra properties on "nt:foldeR", "nt:file", and "nt:resource" nodes.

Returns:
one of "log", "ignore", "error", or "store"
See Also:
getCustomPropertiesFactory()

setExtraPropertiesBehavior

public void setExtraPropertiesBehavior(String behavior)
Set the desired behavior for handling extra properties on "nt:foldeR", "nt:file", and "nt:resource" nodes.

Parameters:
behavior - "log", "ignore", "error", or "store"
See Also:
setCustomPropertiesFactory(CustomPropertiesFactory), setCustomPropertiesFactory(String)

getCustomPropertiesFactory

public CustomPropertiesFactory getCustomPropertiesFactory()
Get the factory that is used to create custom properties on "nt:folder", "nt:file", and "nt:resource" nodes.

Returns:
the factory, or null if no custom properties are to be created

setCustomPropertiesFactory

public void setCustomPropertiesFactory(CustomPropertiesFactory customPropertiesFactory)
Set the factory that is used to create custom properties on "nt:folder", "nt:file", and "nt:resource" nodes.

Parameters:
customPropertiesFactory - the factory reference, or null if no custom properties will be created
See Also:
setExtraPropertiesBehavior(String)

setCustomPropertiesFactory

public void setCustomPropertiesFactory(String customPropertiesFactoryClassName)
                                throws ClassCastException,
                                       ClassNotFoundException,
                                       IllegalAccessException,
                                       InstantiationException
Set the factory that is used to create custom properties on "nt:folder", "nt:file", and "nt:resource" nodes by specifying the name of a class that implements the CustomPropertiesFactory interface and has a public, no-argument constructor.

Parameters:
customPropertiesFactoryClassName - the class name of the factory implementation or null if no custom properties will be created
Throws:
ClassNotFoundException - if the the class for the CustomPropertiesFactory implementation cannot be located
IllegalAccessException - if the custom properties factory class or its nullary constructor is not accessible.
InstantiationException - if the custom properties factory represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ClassCastException - if the class named by customPropertiesFactoryClassName does not implement the CustomPropertiesFactory interface
See Also:
setExtraPropertiesBehavior(String)

isEagerFileLoading

public boolean isEagerFileLoading()
Optional flag that defines whether the connector should eagerly read file content even before it is needed, guaranteeing access to the content. A value of "true" may result in the file content being loaded even when it is not needed, and may increase the memory footprint; a value of "false" will delay reading the file content until it is needed, but changes to the underlying files may leak into the JCR sessions. The default value is "false".

Returns:
'true' if the file is to be read eagerly and preemptively, or false if the file content is to be loaded lazily.

setEagerFileLoading

public void setEagerFileLoading(boolean eagerFileLoading)
Parameters:
eagerFileLoading - Sets eagerFileLoading to the specified value.

getTemporaryStoragePath

public String getTemporaryStoragePath()
Optional setting that allows administrators to specify a specific location for the file system connector's temporary storage. When writing file content, this connector first writes the content to a file in the temporary storage area. After that write succeeds in full, the temporary file is moved to its final location in the workspace. This extra step is taken so that an error or failure while writing the file does not cause corruption in the target file.

However, if the temporary storage area is located on a different file system than the file that will ultimately be written to, the rename operation cannot be used and a separate file copy must occur. Therefore, administrators should set the value of this path to some path in the same file system as the workspace root path.

The default value of this property is the value of System.getProperty("java.io.tmpdir").

Returns:
the directory that should be used for temporary storage; never null

setTemporaryStoragePath

public void setTemporaryStoragePath(String temporaryStoragePath)
Sets the new value for the temporary storage path.

Parameters:
temporaryStoragePath - the new value for the temporary storage path; null indicates that the directory specified by java.io.tmpdir system property should be used

getReference

public Reference getReference()

Specified by:
getReference in interface Referenceable
See Also:
Referenceable.getReference()

getObjectInstance

public Object getObjectInstance(Object obj,
                                Name name,
                                Context nameCtx,
                                Hashtable<?,?> environment)
                         throws Exception

Specified by:
getObjectInstance in interface ObjectFactory
Throws:
Exception

getConnection

public RepositoryConnection getConnection()
                                   throws RepositorySourceException
Get a connection from this source. Even though each RepositorySource need not be thread safe, this method should be safe to be called concurrently by multiple threads.

Specified by:
getConnection in interface RepositorySource
Returns:
a connection
Throws:
RepositorySourceException - if there is a problem obtaining a connection
See Also:
RepositorySource.getConnection()


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