Permalink
Browse files

Fix wrong partition folder location in filesystem

  • Loading branch information...
1 parent ef6c06f commit ea627a18a27cadf4f241ae01743f073f9f32fe95 @ceefour ceefour committed Apr 14, 2012
Showing with 40 additions and 2 deletions.
  1. +25 −0 apacheds/README.textile
  2. +15 −2 apacheds/src/main/java/org/soluvas/apacheds/DirectoryEngine.java
View
@@ -18,3 +18,28 @@ bc.. @Produces @Preferred @ApplicationScoped public DirectoryEngine getDirectory
public void disposeDirectoryEngine(@Disposes @Preferred DirectoryEngine engine) throws Exception {
engine.destroy();
}
+
+h2. FAQ: How to Transfer LDAP Data to Embedded ApacheDS in OpenShift?
+
+Since OpenShift does not allow applications to open TCP/IP ports, there are several alternatives:
+
+1. Access the filesystem directly or remotely (via rsync)
+2. Provide functionality within the app to manipulate Directory contents
+
+No. 1 is the easiest.
+
+Simply run your own ApacheDS Server instance, set it up as you want, then:
+
+1. Stop the OpenShift app
+2. Do an @rsync@ to synchronize the @schema@ and @main@ partitions
+3. Restart the OpenShift app
+
+Example:
+
+bc. ceefour@annafi:/var/lib/apacheds-2.0.0-M6/default/partitions$ rsync -vza --delete schema aksimata-soluvas.rhcloud.com:aksimata/data/ds/partitions/schema
+ceefour@annafi:/var/lib/apacheds-2.0.0-M6/default/partitions$ rsync -vza --delete aksimata aksimata-soluvas.rhcloud.com:aksimata/data/ds/partitions/main
+
+Note: In your local ApacheDS server instance, you don't need to name your partition @main@, you can use any other name. Only the contents
+of the partition needs to be transferred.
+
+You're set. :-)
@@ -62,7 +62,7 @@ private Partition addPartition( String partitionId, String partitionDn ) throws
// Create a new partition named 'foo'.
JdbmPartition partition = new JdbmPartition(service.getSchemaManager());
partition.setId( partitionId );
- partition.setPartitionPath( new File( getWorkDir(), partitionId ).toURI() );
+ partition.setPartitionPath( new File( getPartitionsDir(), partitionId ).toURI() );
partition.setSuffixDn( new Dn(partitionDn) );
service.addPartition( partition );
@@ -82,7 +82,7 @@ private Partition addSystemPartition( String partitionId, String partitionDn ) t
// Create a new partition named 'foo'.
JdbmPartition partition = new JdbmPartition(service.getSchemaManager());
partition.setId( partitionId );
- partition.setPartitionPath( new File( getWorkDir(), partitionId ).toURI() );
+ partition.setPartitionPath( new File( getPartitionsDir(), partitionId ).toURI() );
partition.setSuffixDn( new Dn(partitionDn) );
return partition;
@@ -283,13 +283,26 @@ public void setServerEnabled(boolean serverEnabled) {
this.serverEnabled = serverEnabled;
}
+ /**
+ * Work directory. In OpenShift this would usually be <tt>$HOME/$APP/data/ds</tt>, containing the
+ * folders: <tt>conf</tt>, <tt>log</tt>, <tt>partitions</tt>, <tt>run</tt>.
+ * @return
+ */
public File getWorkDir() {
return workDir;
}
public void setWorkDir(File workDir) {
this.workDir = workDir;
}
+
+ /**
+ * Folder containing partitions, this will be <tt>$WORK_DIR/partitions</tt>, or in OpenShift: <tt>$HOME/$APP/data/ds/partitions</tt>.
+ * @return
+ */
+ public File getPartitionsDir() {
+ return new File(getWorkDir(), "partitions");
+ }
public String getMainDn() {
return mainDn;

0 comments on commit ea627a1

Please sign in to comment.