directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szoer...@apache.org
Subject svn commit: r718057 - /directory/sandbox/szoerner/helloWorldPartition/src/main/java/org/apache/directory/samples/partition/hello/HelloWorldPartition.java
Date Sun, 16 Nov 2008 16:36:18 GMT
Author: szoerner
Date: Sun Nov 16 08:36:18 2008
New Revision: 718057

URL: http://svn.apache.org/viewvc?rev=718057&view=rev
Log:
simplifications

Modified:
    directory/sandbox/szoerner/helloWorldPartition/src/main/java/org/apache/directory/samples/partition/hello/HelloWorldPartition.java

Modified: directory/sandbox/szoerner/helloWorldPartition/src/main/java/org/apache/directory/samples/partition/hello/HelloWorldPartition.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/helloWorldPartition/src/main/java/org/apache/directory/samples/partition/hello/HelloWorldPartition.java?rev=718057&r1=718056&r2=718057&view=diff
==============================================================================
--- directory/sandbox/szoerner/helloWorldPartition/src/main/java/org/apache/directory/samples/partition/hello/HelloWorldPartition.java
(original)
+++ directory/sandbox/szoerner/helloWorldPartition/src/main/java/org/apache/directory/samples/partition/hello/HelloWorldPartition.java
Sun Nov 16 08:36:18 2008
@@ -51,8 +51,9 @@
 
 /**
  * A minimal partition. It is readonly and contains only one entry.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory
+ *         Project</a>
  */
 public class HelloWorldPartition implements Partition {
 
@@ -73,39 +74,35 @@
 
     private ServerEntry helloEntry;
 
-    private DirectoryService directoryService;
-
     public void init(DirectoryService core) throws Exception {
-        
+
         String infoMsg = String.format("Initializing %s with suffix %s", this
                 .getClass().getSimpleName(), this.suffix);
         LOG.info(infoMsg);
-                
-        this.directoryService = core;
 
         // Create LDAP DN
         suffixDn = new LdapDN(suffix);
-        suffixDn.normalize(directoryService.getRegistries()
-                .getAttributeTypeRegistry().getNormalizerMapping());
+        suffixDn.normalize(core.getRegistries().getAttributeTypeRegistry()
+                .getNormalizerMapping());
         Rdn rdn = suffixDn.getRdn();
-        
+
         // Create the only entry in this partition
-        ServerEntry entry = new DefaultServerEntry(this.directoryService
-                .getRegistries(), this.suffixDn);
+        ServerEntry entry = new DefaultServerEntry(core.getRegistries(),
+                this.suffixDn);
         entry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
-                SchemaConstants.ORGANIZATIONAL_UNIT_OC);        
+                SchemaConstants.ORGANIZATIONAL_UNIT_OC);
         entry.put(SchemaConstants.OU_AT, rdn.getUpValue().toString());
         entry.put("description", "hello, world", "a minimal partition");
-        
+
         this.helloEntry = entry;
 
         LOG.info("Initializing done.");
     }
-    
-    public boolean isInitialized() {       
+
+    public boolean isInitialized() {
         return this.helloEntry != null;
     }
-    
+
     public void destroy() throws Exception {
         LOG.info("destroying partition");
     }
@@ -155,7 +152,7 @@
         // return an empty result
         return new BaseEntryFilteringCursor(new EmptyCursor<ServerEntry>(), ctx);
     }
-    
+
     public EntryFilteringCursor list(ListOperationContext opContext) {
         return null;
     }
@@ -169,10 +166,11 @@
     }
 
     /**
-     * @throws IllegalArgumentException if suffix does not start with ou=
+     * @throws IllegalArgumentException
+     *             if suffix does not start with ou=
      */
     public void setSuffix(String suffix) {
-        if (! suffix.startsWith("ou=")) {           
+        if (!suffix.startsWith("ou=")) {
             throw new IllegalArgumentException("suffix has to start with ou");
         }
         this.suffix = suffix;
@@ -239,7 +237,6 @@
                 MODIFICATION_NOT_ALLOWED_MSG, UNWILLING_TO_PERFORM);
     }
 
-
     public void sync() {
     }
 }



Mime
View raw message