directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r811864 - /directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/
Date Sun, 06 Sep 2009 19:10:33 GMT
Author: akarasulu
Date: Sun Sep  6 19:10:32 2009
New Revision: 811864

URL: http://svn.apache.org/viewvc?rev=811864&view=rev
Log:
commiting some builder classes before refactoring

Added:
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/BootstrapRegistryLoader.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DefaultRegistryFactory.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DirectoryServiceBuilder.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/JarLdifBootstrapRegistryLoader.java
    directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/RegistryFactory.java

Added: directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/BootstrapRegistryLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/BootstrapRegistryLoader.java?rev=811864&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/BootstrapRegistryLoader.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/BootstrapRegistryLoader.java
Sun Sep  6 19:10:32 2009
@@ -0,0 +1,49 @@
+/*
+ *   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.directory.server.core.builder;
+
+
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
+
+/**
+ * Loads a {@link Registries} instances with the bootstrap schema:
+ * 
+ * <ul>
+ *   <li>apache</li>
+ *   <li>apachemeta</li>
+ *   <li>core</li>
+ *   <li>system</li>
+ * </ul>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface BootstrapRegistryLoader
+{
+    /**
+     * Service method that loads the {@link Registries} with the bootstrap
+     * schema.
+     *
+     * @param registries the {@link Registries} to load
+     * @throws Exception if the load fails for any reason
+     */
+    void loadBootstrapSchema( Registries registries ) throws Exception;
+}

Added: directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DefaultRegistryFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DefaultRegistryFactory.java?rev=811864&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DefaultRegistryFactory.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DefaultRegistryFactory.java
Sun Sep  6 19:10:32 2009
@@ -0,0 +1,51 @@
+/*
+ *   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.directory.server.core.builder;
+
+
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
+
+/**
+ * A {@link RegistryFactory} implementation which holds and returns a 
+ * reference to a Registries instance.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DefaultRegistryFactory implements RegistryFactory
+{
+    private final Registries registries;
+    
+    
+    public DefaultRegistryFactory()
+    {
+        this.registries = new Registries();
+    }
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.builder.RegistryFactory#getRegistries()
+     */
+    public Registries getRegistries()
+    {
+        return registries;
+    }
+}

Added: directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DirectoryServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DirectoryServiceBuilder.java?rev=811864&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DirectoryServiceBuilder.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/DirectoryServiceBuilder.java
Sun Sep  6 19:10:32 2009
@@ -0,0 +1,85 @@
+/*
+ *   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.directory.server.core.builder;
+
+
+import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.avl.AvlPartition;
+import org.apache.directory.server.core.schema.DefaultSchemaChangeManager;
+import org.apache.directory.server.core.schema.PartitionSchemaLoader;
+import org.apache.directory.server.core.schema.SchemaChangeManager;
+import org.apache.directory.server.core.schema.SchemaPartition;
+import org.apache.directory.server.core.schema.SchemaPartitionDao;
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
+
+/**
+ * TODO DirectoryServiceBuilder.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DirectoryServiceBuilder
+{
+    private DirectoryService directoryService = null;
+    private RegistryFactory registryFactory = null;
+    private BootstrapRegistryLoader bootstrapRegistryLoader = null;
+    private Partition wrappedPartition = null;
+    private SchemaPartition schemaPartition = null;
+    private SchemaChangeManager schemaChangeManger = null;
+    private PartitionSchemaLoader partitionSchemaLoader = null;
+    private SchemaPartitionDao schemaPartitionDao = null;
+    
+    
+    public DirectoryServiceBuilder() throws Exception
+    {
+        directoryService = new DefaultDirectoryService();
+        registryFactory = new DefaultRegistryFactory();
+        bootstrapRegistryLoader = new JarLdifBootstrapRegistryLoader();
+        wrappedPartition = new AvlPartition();
+        schemaPartition = new SchemaPartition();
+    }
+    
+    
+    public void build() throws Exception
+    {
+        Registries registries = registryFactory.getRegistries();
+        bootstrapRegistryLoader.loadBootstrapSchema( registries );
+    
+        schemaPartitionDao = new SchemaPartitionDao( wrappedPartition, registries );
+        partitionSchemaLoader = new PartitionSchemaLoader( wrappedPartition, registries );
+        schemaChangeManger = new DefaultSchemaChangeManager( registries, partitionSchemaLoader,
schemaPartitionDao );
+        
+        schemaPartition.setWrappedPartition( wrappedPartition );
+        schemaPartition.setRegistries( registries );
+        schemaPartition.setSchemaChangeManager( schemaChangeManger );
+        schemaPartition.initialize();
+        
+        partitionSchemaLoader.loadAllEnabled( registries );
+    }
+    
+    
+    public DirectoryService getDirectoryService() throws Exception
+    {
+        return directoryService;
+    }
+}

Added: directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/JarLdifBootstrapRegistryLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/JarLdifBootstrapRegistryLoader.java?rev=811864&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/JarLdifBootstrapRegistryLoader.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/JarLdifBootstrapRegistryLoader.java
Sun Sep  6 19:10:32 2009
@@ -0,0 +1,51 @@
+/*
+ *   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.directory.server.core.builder;
+
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.registries.SchemaLoader;
+import org.apache.directory.shared.schema.loader.ldif.JarLdifSchemaLoader;
+
+/**
+ * TODO JarLdifBootstrapRegistryLoader.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class JarLdifBootstrapRegistryLoader implements BootstrapRegistryLoader
+{
+    private final SchemaLoader schemaLoader;
+
+    
+    public JarLdifBootstrapRegistryLoader() throws Exception
+    {
+        schemaLoader = new JarLdifSchemaLoader();
+    }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.server.core.builder.BootstrapRegistryLoader#loadBootstrapSchema(org.apache.directory.shared.ldap.schema.registries.Registries)
+     */
+    public void loadBootstrapSchema( Registries registries ) throws Exception
+    {
+        schemaLoader.loadAllEnabled( registries );
+    }
+}

Added: directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/RegistryFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/RegistryFactory.java?rev=811864&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/RegistryFactory.java
(added)
+++ directory/apacheds/branches/apacheds-schema/core-builder/src/main/java/org/apache/directory/server/core/builder/RegistryFactory.java
Sun Sep  6 19:10:32 2009
@@ -0,0 +1,34 @@
+/*
+ *   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.directory.server.core.builder;
+
+import org.apache.directory.shared.ldap.schema.registries.Registries;
+
+
+/**
+ * TODO RegistryFactory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface RegistryFactory
+{
+    Registries getRegistries();
+}



Mime
View raw message