|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.modeshape.graph.connector.base.AbstractRepositorySource org.modeshape.connector.filesystem.FileSystemSource
@ThreadSafe public class FileSystemSource
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.
Nested Class Summary | |
---|---|
protected static class |
FileSystemSource.StandardPropertiesFactory
|
Field Summary | |
---|---|
protected static String |
ALLOW_CREATING_WORKSPACES
|
protected static String |
CUSTOM_PROPERTY_FACTORY
|
static String |
DEFAULT_EXCLUSION_PATTERN
|
static FilenameFilter |
DEFAULT_FILENAME_FILTER
|
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 CustomPropertiesFactory |
DEFAULT_PROPERTIES_FACTORY
An immutable CustomPropertiesFactory implementation that is used by default when none is provided. |
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}. |
protected static String |
DEFAULT_WORKSPACE
|
protected static String |
EXCLUSION_PATTERN
|
protected static String |
FILENAME_FILTER
|
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 |
WORKSPACE_ROOT
|
Fields inherited from class org.modeshape.graph.connector.base.AbstractRepositorySource |
---|
cachePolicy, DEFAULT_CACHE_POLICY, DEFAULT_RETRY_LIMIT, DEFAULT_ROOT_NODE_UUID, name, 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 |
FilenameFilter |
getFilenameFilter()
|
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()
|
boolean |
getUpdatesAllowed()
Get whether this source supports updates. |
String |
getWorkspaceRootPath()
Get the relative root directory for the workspaces. |
boolean |
isCreatingWorkspacesAllowed()
Get whether this source allows workspaces to be created dynamically. |
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 |
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 the exclusionPattern and filenameFilter properties may be non-null at any one time. |
void |
setFilenameFilter(FilenameFilter filenameFilter)
Sets the filename filter that is used to restrict which content can be accessed by this connector Only one of the exclusionPattern and filenameFilter properties may be non-null at any one 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 |
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 |
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.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 |
---|
protected static CustomPropertiesFactory DEFAULT_PROPERTIES_FACTORY
CustomPropertiesFactory
implementation that is used by default when none is provided. Note that this
implementation does restrict the properties that can be placed on file, folder and resource nodes.
public static final String DEFAULT_NAME_OF_DEFAULT_WORKSPACE
name of the default workspace
is ""default" ", unless otherwise specified.
protected static final String SOURCE_NAME
protected static final String DEFAULT_WORKSPACE
protected static final String WORKSPACE_ROOT
protected static final String PREDEFINED_WORKSPACE_NAMES
protected static final String ALLOW_CREATING_WORKSPACES
protected static final String MAX_PATH_LENGTH
protected static final String EXCLUSION_PATTERN
protected static final String FILENAME_FILTER
protected static final String CUSTOM_PROPERTY_FACTORY
protected static final boolean SUPPORTS_EVENTS
protected static final boolean SUPPORTS_SAME_NAME_SIBLINGS
protected static final boolean DEFAULT_SUPPORTS_CREATING_WORKSPACES
public static final boolean DEFAULT_SUPPORTS_UPDATES
protected static final boolean SUPPORTS_REFERENCES
public static final int DEFAULT_MAX_PATH_LENGTH
public static final String DEFAULT_EXCLUSION_PATTERN
public static final FilenameFilter DEFAULT_FILENAME_FILTER
Constructor Detail |
---|
public FileSystemSource()
Method Detail |
---|
public RepositorySourceCapabilities getCapabilities()
getCapabilities
in interface RepositorySource
RepositorySource.getCapabilities()
public boolean getUpdatesAllowed()
public String getWorkspaceRootPath()
public void setWorkspaceRootPath(String workspaceRootPath)
workspaceRootPath
- the relative root directory for workspaces. If this value is non-null, all workspace paths will be
treated as paths relative to this directorypublic String getExclusionPattern()
public void setExclusionPattern(String exclusionPattern)
Only one of the exclusionPattern
and filenameFilter
properties may be non-null at any one time. Calling
this method automatically sets the filenameFilter
property to null
.
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.public FilenameFilter getFilenameFilter()
public void setFilenameFilter(FilenameFilter filenameFilter)
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
.
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.public void setFilenameFilter(String filenameFilterClassName) throws ClassCastException, ClassNotFoundException, IllegalAccessException, InstantiationException
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
.
filenameFilterClassName
- the class name of the filter implementation or null if no filename filter should be used
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
interfacepublic int getMaxPathLength()
public void setMaxPathLength(int maxPathLength)
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).
maxPathLength
- the maximum absolute path length supported by this source; must be non-negativepublic String getDefaultWorkspaceName()
getDefaultWorkspaceName
in interface BaseRepositorySource
public void setDefaultWorkspaceName(String nameOfDefaultWorkspace)
nameOfDefaultWorkspace
- the name of the workspace that should be used by default, or null if the
default name
should be usedpublic String[] getPredefinedWorkspaceNames()
setPredefinedWorkspaceNames(String[])
,
setCreatingWorkspacesAllowed(boolean)
public void setPredefinedWorkspaceNames(String[] predefinedWorkspaceNames)
predefinedWorkspaceNames
- the names of the workspaces that this source should start with, or null if there are no
such workspacessetCreatingWorkspacesAllowed(boolean)
,
getPredefinedWorkspaceNames()
public boolean isCreatingWorkspacesAllowed()
setPredefinedWorkspaceNames(String[])
,
getPredefinedWorkspaceNames()
,
setCreatingWorkspacesAllowed(boolean)
public void setCreatingWorkspacesAllowed(boolean allowWorkspaceCreation)
allowWorkspaceCreation
- true if this source allows workspaces to be created by clients, or false if the set of
workspaces is fixedsetPredefinedWorkspaceNames(String[])
,
getPredefinedWorkspaceNames()
,
isCreatingWorkspacesAllowed()
public boolean areUpdatesAllowed()
areUpdatesAllowed
in interface BaseRepositorySource
areUpdatesAllowed
in class AbstractRepositorySource
setUpdatesAllowed(boolean)
public void setUpdatesAllowed(boolean allowUpdates)
setUpdatesAllowed
in interface BaseRepositorySource
allowUpdates
- true if this source allows updates to data within workspaces clients, or false if updates are not
allowed.areUpdatesAllowed()
public CustomPropertiesFactory getCustomPropertiesFactory()
public void setCustomPropertiesFactory(CustomPropertiesFactory customPropertiesFactory)
customPropertiesFactory
- the factory reference, or null if no custom properties will be createdpublic void setCustomPropertiesFactory(String customPropertiesFactoryClassName) throws ClassCastException, ClassNotFoundException, IllegalAccessException, InstantiationException
CustomPropertiesFactory
interface and has a public, no-argument
constructor.
customPropertiesFactoryClassName
- the class name of the factory implementation or null if no custom properties will
be created
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
interfacepublic Reference getReference()
getReference
in interface Referenceable
Referenceable.getReference()
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception
getObjectInstance
in interface ObjectFactory
Exception
public RepositoryConnection getConnection() throws RepositorySourceException
getConnection
in interface RepositorySource
RepositorySourceException
- if there is a problem obtaining a connectionRepositorySource.getConnection()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |