You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2008/08/23 00:29:29 UTC
svn commit: r688207 - in
/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core:
./ config/ fs/
Author: jukka
Date: Fri Aug 22 15:29:28 2008
New Revision: 688207
URL: http://svn.apache.org/viewvc?rev=688207&view=rev
Log:
JCR-1438: Replace Config classes with factories
Replaced FileSystemConfig with FileSystemFactory.
Added:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java
Removed:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java
Modified:
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java
jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java Fri Aug 22 15:29:28 2008
@@ -32,7 +32,6 @@
import org.apache.jackrabbit.core.cluster.UpdateEventListener;
import org.apache.jackrabbit.core.config.ClusterConfig;
import org.apache.jackrabbit.core.config.DataStoreConfig;
-import org.apache.jackrabbit.core.config.FileSystemConfig;
import org.apache.jackrabbit.core.config.PersistenceManagerConfig;
import org.apache.jackrabbit.core.config.RepositoryConfig;
import org.apache.jackrabbit.core.config.SecurityManagerConfig;
@@ -248,7 +247,7 @@
repLock.acquire();
// setup file systems
- repStore = repConfig.getFileSystemConfig().createFileSystem();
+ repStore = repConfig.getFileSystem();
String fsRootPath = "/meta";
try {
if (!repStore.exists(fsRootPath) || !repStore.isFolder(fsRootPath)) {
@@ -423,7 +422,7 @@
throws RepositoryException {
- FileSystem fs = vConfig.getFileSystemConfig().createFileSystem();
+ FileSystem fs = vConfig.getFileSystem();
PersistenceManager pm = createPersistenceManager(vConfig.getHomeDir(),
fs,
vConfig.getPersistenceManagerConfig(),
@@ -1836,8 +1835,7 @@
* @throws RepositoryException if an error occurs.
*/
protected void doInitialize() throws RepositoryException {
- FileSystemConfig fsConfig = config.getFileSystemConfig();
- fs = fsConfig.createFileSystem();
+ fs = config.getFileSystem();
persistMgr = createPersistenceManager(new File(config.getHomeDir()),
fs,
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java Fri Aug 22 15:29:28 2008
@@ -187,11 +187,7 @@
NodeId rootNodeId,
SearchManager parentMgr,
NodeId excludedNodeId) throws RepositoryException {
- if (config.getFileSystemConfig() != null) {
- fs = config.getFileSystemConfig().createFileSystem();
- } else {
- fs = null;
- }
+ this.fs = config.getFileSystem();
this.config = config;
this.ntReg = ntReg;
this.nsReg = nsReg;
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java Fri Aug 22 15:29:28 2008
@@ -19,12 +19,14 @@
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.core.fs.FileSystem;
import org.apache.jackrabbit.core.fs.FileSystemException;
+import org.apache.jackrabbit.core.fs.FileSystemFactory;
import org.apache.jackrabbit.core.fs.FileSystemPathUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
+import javax.jcr.RepositoryException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
@@ -59,7 +61,7 @@
* addition the workspace configuration object keeps track of all configured
* workspaces.
*/
-public class RepositoryConfig {
+public class RepositoryConfig implements FileSystemFactory {
/** the default logger */
private static Logger log = LoggerFactory.getLogger(RepositoryConfig.class);
@@ -161,9 +163,9 @@
private final SecurityConfig sec;
/**
- * Repository file system configuration.
+ * Repository file system factory.
*/
- private final FileSystemConfig fsc;
+ private final FileSystemFactory fsf;
/**
* Name of the default workspace.
@@ -228,7 +230,7 @@
*
* @param home repository home directory
* @param sec the security configuration
- * @param fsc file system configuration
+ * @param fsf file system factory
* @param workspaceDirectory workspace root directory
* @param workspaceConfigDirectory optional workspace configuration directory
* @param defaultWorkspace name of the default workspace
@@ -240,7 +242,8 @@
* @param dataStoreConfig configuration for data store
* @param parser configuration parser
*/
- public RepositoryConfig(String home, SecurityConfig sec, FileSystemConfig fsc,
+ public RepositoryConfig(
+ String home, SecurityConfig sec, FileSystemFactory fsf,
String workspaceDirectory, String workspaceConfigDirectory,
String defaultWorkspace, int workspaceMaxIdleTime,
Element template, VersioningConfig vc, SearchConfig sc,
@@ -248,7 +251,7 @@
workspaces = new HashMap();
this.home = home;
this.sec = sec;
- this.fsc = fsc;
+ this.fsf = fsf;
this.workspaceDirectory = workspaceDirectory;
this.workspaceConfigDirectory = workspaceConfigDirectory;
this.workspaceMaxIdleTime = workspaceMaxIdleTime;
@@ -283,34 +286,33 @@
// Get all workspace subdirectories
if (workspaceConfigDirectory != null) {
- // a configuration directoy had been specified; search for
+ // a configuration directory had been specified; search for
// workspace configurations in virtual repository file system
// rather than in physical workspace root directory on disk
- FileSystem fs = fsc.createFileSystem();
try {
- if (!fs.exists(workspaceConfigDirectory)) {
- fs.createFolder(workspaceConfigDirectory);
- } else {
- String[] dirNames = fs.listFolders(workspaceConfigDirectory);
- for (int i = 0; i < dirNames.length; i++) {
- String configDir = workspaceConfigDirectory
- + FileSystem.SEPARATOR + dirNames[i];
- WorkspaceConfig wc = loadWorkspaceConfig(fs, configDir);
- if (wc != null) {
- addWorkspaceConfig(wc);
+ FileSystem fs = fsf.getFileSystem();
+ try {
+ if (!fs.exists(workspaceConfigDirectory)) {
+ fs.createFolder(workspaceConfigDirectory);
+ } else {
+ String[] dirNames = fs.listFolders(workspaceConfigDirectory);
+ for (int i = 0; i < dirNames.length; i++) {
+ String configDir = workspaceConfigDirectory
+ + FileSystem.SEPARATOR + dirNames[i];
+ WorkspaceConfig wc = loadWorkspaceConfig(fs, configDir);
+ if (wc != null) {
+ addWorkspaceConfig(wc);
+ }
}
- }
+ }
+ } finally {
+ fs.close();
}
- } catch (FileSystemException e) {
+ } catch (Exception e) {
throw new ConfigurationException(
"error while loading workspace configurations from path "
+ workspaceConfigDirectory, e);
- } finally {
- try {
- fs.close();
- } catch (FileSystemException ignore) {
- }
}
} else {
// search for workspace configurations in physical workspace root
@@ -482,7 +484,11 @@
// a configuration directoy had been specified;
// workspace configurations are maintained in
// virtual repository file system
- virtualFS = fsc.createFileSystem();
+ try {
+ virtualFS = fsf.getFileSystem();
+ } catch (RepositoryException e) {
+ throw new ConfigurationException("File system configuration error", e);
+ }
} else {
// workspace configurations are maintained on disk
virtualFS = null;
@@ -621,12 +627,13 @@
}
/**
- * Returns the repository file system configuration.
+ * Creates and returns the configured repository file system.
*
- * @return file system configuration
+ * @return the configured {@link FileSystem}
+ * @throws RepositoryException if the file system can not be created
*/
- public FileSystemConfig getFileSystemConfig() {
- return fsc;
+ public FileSystem getFileSystem() throws RepositoryException {
+ return fsf.getFileSystem();
}
/**
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java Fri Aug 22 15:29:28 2008
@@ -16,6 +16,9 @@
*/
package org.apache.jackrabbit.core.config;
+import org.apache.jackrabbit.core.fs.FileSystem;
+import org.apache.jackrabbit.core.fs.FileSystemException;
+import org.apache.jackrabbit.core.fs.FileSystemFactory;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -24,6 +27,8 @@
import java.io.File;
import java.util.Properties;
+import javax.jcr.RepositoryException;
+
/**
* Configuration parser. This class is used to parse the repository and
* workspace configuration files.
@@ -212,8 +217,7 @@
String home = getVariables().getProperty(REPOSITORY_HOME_VARIABLE);
// File system implementation
- FileSystemConfig fsc =
- new FileSystemConfig(parseBeanConfig(root, FILE_SYSTEM_ELEMENT));
+ FileSystemFactory fsf = getFileSystemFactory(root, FILE_SYSTEM_ELEMENT);
// Security configuration and access manager implementation
Element security = getElement(root, SECURITY_ELEMENT);
@@ -248,7 +252,7 @@
// Optional data store configuration
DataStoreConfig dsc = parseDataStoreConfig(root);
- return new RepositoryConfig(home, securityConfig, fsc,
+ return new RepositoryConfig(home, securityConfig, fsf,
workspaceDirectory, workspaceConfigDirectory, defaultWorkspace,
maxIdleTime, template, vc, sc, cc, dsc, this);
}
@@ -412,8 +416,8 @@
RepositoryConfigurationParser tmpParser = createSubParser(tmpVariables);
// File system implementation
- FileSystemConfig fsc = new FileSystemConfig(
- tmpParser.parseBeanConfig(root, FILE_SYSTEM_ELEMENT));
+ FileSystemFactory fsf =
+ tmpParser.getFileSystemFactory(root, FILE_SYSTEM_ELEMENT);
// Persistence manager implementation
PersistenceManagerConfig pmc = tmpParser.parsePersistenceManagerConfig(root);
@@ -427,7 +431,7 @@
// workspace specific security configuration
WorkspaceSecurityConfig workspaceSecurityConfig = tmpParser.parseWorkspaceSecurityConfig(root);
- return new WorkspaceConfig(home, name, clustered, fsc, pmc, sc, ismLockingConfig, workspaceSecurityConfig);
+ return new WorkspaceConfig(home, name, clustered, fsf, pmc, sc, ismLockingConfig, workspaceSecurityConfig);
}
/**
@@ -474,13 +478,12 @@
Properties parameters = parseParameters(element);
// Optional file system implementation
- FileSystemConfig fsc = null;
+ FileSystemFactory fsf = null;
if (getElement(element, FILE_SYSTEM_ELEMENT, false) != null) {
- fsc = new FileSystemConfig(
- parseBeanConfig(element, FILE_SYSTEM_ELEMENT));
+ fsf = getFileSystemFactory(element, FILE_SYSTEM_ELEMENT);
}
- return new SearchConfig(className, parameters, fsc);
+ return new SearchConfig(className, parameters, fsf);
}
}
return null;
@@ -585,8 +588,8 @@
replaceVariables(getAttribute(element, ROOT_PATH_ATTRIBUTE));
// File system implementation
- FileSystemConfig fsc = new FileSystemConfig(
- parseBeanConfig(element, FILE_SYSTEM_ELEMENT));
+ FileSystemFactory fsf =
+ getFileSystemFactory(element, FILE_SYSTEM_ELEMENT);
// Persistence manager implementation
PersistenceManagerConfig pmc = parsePersistenceManagerConfig(element);
@@ -594,7 +597,7 @@
// Item state manager locking configuration (optional)
ISMLockingConfig ismLockingConfig = parseISMLockingConfig(element);
- return new VersioningConfig(home, fsc, pmc, ismLockingConfig);
+ return new VersioningConfig(home, fsf, pmc, ismLockingConfig);
}
/**
@@ -717,4 +720,34 @@
return new RepositoryConfigurationParser(props);
}
+ /**
+ * Creates and returns a factory object that creates {@link FileSystem}
+ * instances based on the bean configuration at the named element.
+ *
+ * @param parent parent element
+ * @param name name of the bean configuration element
+ * @return file system factory
+ * @throws ConfigurationException if the bean configuration is invalid
+ */
+ private FileSystemFactory getFileSystemFactory(Element parent, String name)
+ throws ConfigurationException {
+ final BeanConfig config = parseBeanConfig(parent, name);
+ return new FileSystemFactory() {
+ public FileSystem getFileSystem() throws RepositoryException {
+ try {
+ FileSystem fs = (FileSystem) config.newInstance();
+ fs.init();
+ return fs;
+ } catch (ClassCastException e) {
+ throw new RepositoryException(
+ "Invalid file system implementation class: "
+ + config.getClassName(), e);
+ } catch (FileSystemException e) {
+ throw new RepositoryException(
+ "File system initialization failure.", e);
+ }
+ }
+ };
+ }
+
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java Fri Aug 22 15:29:28 2008
@@ -18,6 +18,11 @@
import java.util.Properties;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.fs.FileSystem;
+import org.apache.jackrabbit.core.fs.FileSystemFactory;
+
/**
* Search index configuration. This bean configuration class
* is used to create configured search index objects.
@@ -28,26 +33,24 @@
*
* @see WorkspaceConfig#getSearchConfig()
*/
-public class SearchConfig extends BeanConfig {
+public class SearchConfig extends BeanConfig implements FileSystemFactory {
/**
- * The search index file system configuration, or <code>null</code> if
- * none is provided.
+ * The (optional) factory for creating the configured search file system.
*/
- private final FileSystemConfig fsc;
+ private final FileSystemFactory fsf;
/**
* Creates a search index configuration object.
*
* @param className search index implementation class
* @param properties search index properties
- * @param fsc search index file system configuration, or <code>null</code>
- * if none is configured.
+ * @param fsf configured search index file system factory, or <code>null</code>
*/
public SearchConfig(
- String className, Properties properties, FileSystemConfig fsc) {
+ String className, Properties properties, FileSystemFactory fsf) {
super(className, properties);
- this.fsc = fsc;
+ this.fsf = fsf;
}
/**
@@ -60,12 +63,18 @@
}
/**
- * Returns the configuration for the <code>FileSystem</code> or
- * <code>null</code> if none is configured in this <code>SearchConfig</code>.
+ * Creates and returns the configured search file system, or returns
+ * <code>null</code> if a search file system has not been configured.
*
- * @return the <code>FileSystemConfig</code> for this <code>SearchConfig</code>.
+ * @return the configured {@link FileSystem}, or <code>null</code>
+ * @throws RepositoryException if the file system can not be created
*/
- public FileSystemConfig getFileSystemConfig() {
- return fsc;
+ public FileSystem getFileSystem() throws RepositoryException {
+ if (fsf != null) {
+ return fsf.getFileSystem();
+ } else {
+ return null;
+ }
}
+
}
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java Fri Aug 22 15:29:28 2008
@@ -18,6 +18,11 @@
import java.io.File;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.fs.FileSystem;
+import org.apache.jackrabbit.core.fs.FileSystemFactory;
+
/**
* Versioning configuration. This configuration class is used to
* create configured versioning objects.
@@ -28,7 +33,7 @@
*
* @see RepositoryConfig#getVersioningConfig()
*/
-public class VersioningConfig {
+public class VersioningConfig implements FileSystemFactory {
/**
* Versioning home directory.
@@ -36,9 +41,9 @@
private final String home;
/**
- * Versioning file system configuration.
+ * Versioning file system factory.
*/
- private final FileSystemConfig fsc;
+ private final FileSystemFactory fsf;
/**
* Versioning persistence manager configuration.
@@ -54,18 +59,18 @@
* Creates a versioning configuration object.
*
* @param home home directory
- * @param fsc file system configuration
+ * @param fsf file system factory
* @param pmc persistence manager configuration
* @param ismLockingConfig the item state manager locking configuration, if
* <code>null</code> is passed a default
* configuration is used.
*/
public VersioningConfig(String home,
- FileSystemConfig fsc,
+ FileSystemFactory fsf,
PersistenceManagerConfig pmc,
ISMLockingConfig ismLockingConfig) {
this.home = home;
- this.fsc = fsc;
+ this.fsf = fsf;
this.pmc = pmc;
if (ismLockingConfig != null) {
this.ismLockingConfig = ismLockingConfig;
@@ -84,12 +89,13 @@
}
/**
- * Returns the configuration for the <code>FileSystem</code>.
+ * Creates and returns the configured versioning file system.
*
- * @return the <code>FileSystemConfig</code> for this <code>VersionConfig</code>.
+ * @return the configured {@link FileSystem}
+ * @throws RepositoryException if the file system can not be created
*/
- public FileSystemConfig getFileSystemConfig() {
- return fsc;
+ public FileSystem getFileSystem() throws RepositoryException {
+ return fsf.getFileSystem();
}
/**
Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java?rev=688207&r1=688206&r2=688207&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java Fri Aug 22 15:29:28 2008
@@ -16,6 +16,11 @@
*/
package org.apache.jackrabbit.core.config;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.fs.FileSystem;
+import org.apache.jackrabbit.core.fs.FileSystemFactory;
+
/**
* Workspace configuration. This configuration class is used to create
* configured workspace objects.
@@ -25,7 +30,7 @@
* the item state manager locking configuration. The search index and the item
* state manager locking and the security config are optional parts.
*/
-public class WorkspaceConfig {
+public class WorkspaceConfig implements FileSystemFactory {
/**
* Workspace home directory.
@@ -43,9 +48,9 @@
private final boolean clustered;
/**
- * Workspace file system configuration.
+ * Workspace file system factory.
*/
- private FileSystemConfig fsc;
+ private FileSystemFactory fsf;
/**
* Workspace persistence manager configuration.
@@ -72,7 +77,7 @@
*
* @param home home directory
* @param name workspace name
- * @param fsc file system configuration
+ * @param fsc file system factory
* @param pmc persistence manager configuration
* @param sc search index configuration
* @param ismLockingConfig the item state manager locking configuration. If
@@ -80,13 +85,13 @@
* @param workspaceSecurityConfig the workspace specific security configuration.
*/
public WorkspaceConfig(String home, String name, boolean clustered,
- FileSystemConfig fsc, PersistenceManagerConfig pmc,
+ FileSystemFactory fsf, PersistenceManagerConfig pmc,
SearchConfig sc, ISMLockingConfig ismLockingConfig,
WorkspaceSecurityConfig workspaceSecurityConfig) {
this.home = home;
this.name = name;
this.clustered = clustered;
- this.fsc = fsc;
+ this.fsf = fsf;
this.pmc = pmc;
this.sc = sc;
if (ismLockingConfig != null) {
@@ -133,12 +138,13 @@
}
/**
- * Returns the file system configuration.
+ * Creates and returns the configured workspace file system.
*
- * @return file system configuration
+ * @return the configured {@link FileSystem}
+ * @throws RepositoryException if the file system can not be created
*/
- public FileSystemConfig getFileSystemConfig() {
- return fsc;
+ public FileSystem getFileSystem() throws RepositoryException {
+ return fsf.getFileSystem();
}
/**
Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java?rev=688207&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/FileSystemFactory.java Fri Aug 22 15:29:28 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core.fs;
+
+import javax.jcr.RepositoryException;
+
+/**
+ * Factory interface for creating {@link FileSystem} instances. Used
+ * to decouple the repository internals from the repository configuration
+ * mechanism.
+ */
+public interface FileSystemFactory {
+
+ /**
+ * Creates, initializes, and returns a {@link FileSystem} instance
+ * for use by the repository. Note that no information is passed from
+ * the client, so all required configuration information must be
+ * encapsulated in the factory.
+ *
+ * @return initialized file system
+ * @throws RepositoryException if the file system can not be created
+ */
+ FileSystem getFileSystem() throws RepositoryException;
+
+}