You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sz...@apache.org on 2009/05/25 21:06:45 UTC
svn commit: r778470 -
/directory/sandbox/szoerner/apacheds-tomcatrealm/src/main/java/org/apache/directory/tomcatrealm/EmbeddedApacheDsRealm.java
Author: szoerner
Date: Mon May 25 19:06:44 2009
New Revision: 778470
URL: http://svn.apache.org/viewvc?rev=778470&view=rev
Log:
Configuration of working directory added
Modified:
directory/sandbox/szoerner/apacheds-tomcatrealm/src/main/java/org/apache/directory/tomcatrealm/EmbeddedApacheDsRealm.java
Modified: directory/sandbox/szoerner/apacheds-tomcatrealm/src/main/java/org/apache/directory/tomcatrealm/EmbeddedApacheDsRealm.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/apacheds-tomcatrealm/src/main/java/org/apache/directory/tomcatrealm/EmbeddedApacheDsRealm.java?rev=778470&r1=778469&r2=778470&view=diff
==============================================================================
--- directory/sandbox/szoerner/apacheds-tomcatrealm/src/main/java/org/apache/directory/tomcatrealm/EmbeddedApacheDsRealm.java (original)
+++ directory/sandbox/szoerner/apacheds-tomcatrealm/src/main/java/org/apache/directory/tomcatrealm/EmbeddedApacheDsRealm.java Mon May 25 19:06:44 2009
@@ -71,6 +71,9 @@
/* Default port the embedded ApacheDS will listen to via LDAP */
public static final int DEFAULT_LDAP_PORT = 10389;
+ /* Default working directory where ApacheDS will store its data. Relative to catalina.home */
+ public static final String DEFAULT_WORKING_DIRECTORY = "apacheDsWorkingDir";
+
private DirectoryService directoryService;
private SocketAcceptor socketAcceptor;
@@ -87,6 +90,8 @@
private String groupSearchBase = DEFAULT_GROUP_SEARCH_BASE;
+ private String workingDirectory = DEFAULT_WORKING_DIRECTORY;
+
public EmbeddedApacheDsRealm()
{
@@ -116,15 +121,21 @@
ldapService.setIpPort( this.ldapPort );
// Determine an appropriate working directory
- // ??
- String catalinaHome = System.getProperty( "catalina.home" );
- String workingDir = catalinaHome+File.separator+"apacheDsWorkingDir";
-
- log.debug( "Working Dir = " +workingDir);
-
- directoryService.setWorkingDirectory( new File(workingDir) );
-
+ //
+ File workingDirectoryFile = new File( this.workingDirectory );
+ if ( !workingDirectoryFile.isAbsolute() )
+ {
+ String catalinaHome = System.getProperty( "catalina.home" );
+ File catalineHomeFile = new File( catalinaHome );
+ workingDirectoryFile = new File( catalineHomeFile, this.workingDirectory );
+ }
+ directoryService.setWorkingDirectory( workingDirectoryFile );
+
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Working Dir = " + workingDirectoryFile );
+ }
directoryService.startup();
ldapService.start();
@@ -261,7 +272,7 @@
/**
- * Sets the port number ApacheDS will listen to via LDAP. #
+ * Sets the port number ApacheDS will listen to via LDAP.
* Defaults to 10389.
*
* @param ldapPort the LDAP port
@@ -273,6 +284,28 @@
/**
+ * Gets the working directory where ApacheDS stores its data.
+ *
+ * @return working directory, absolute or relative to Tomcat's home directory
+ */
+ public String getWorkingDirectory()
+ {
+ return workingDirectory;
+ }
+
+
+ /**
+ * Sets the working directory where ApacheDS stores its data.
+ *
+ * @param workingDirectory directory, absolute or relative to Tomcat's home directory
+ */
+ public void setWorkingDirectory( String workingDirectory )
+ {
+ this.workingDirectory = workingDirectory;
+ }
+
+
+ /**
* Return the Principal associated with the specified username and
* credentials, if there is one; otherwise return null.
*/