You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2005/01/30 19:53:50 UTC
svn commit: r149139 -
incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java
incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirStateFactory.java
Author: akarasulu
Date: Sun Jan 30 10:53:49 2005
New Revision: 149139
URL: http://svn.apache.org/viewcvs?view=rev&rev=149139
Log:
some basic interfaces for efficient object and state factories
Added:
incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java
incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirStateFactory.java
Added: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java?view=auto&rev=149139
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java (added)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirObjectFactory.java Sun Jan 30 10:53:49 2005
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.ldap.server.jndi;
+
+
+import javax.naming.spi.DirObjectFactory;
+
+
+/**
+ * A specialized ObjectFactory that is optimized for our server-side JNDI
+ * provider. This factory reports the Class of objects that it is creates as
+ * well as the objectClass corresponding to that Class. This makes it easier
+ * for the server side provider to lookup the respective factory rather than
+ * attempt several others within the list of object factories in the order of
+ * greatest specificity. JNDI SPI methods are inefficient since they are
+ * designed to try all object factories to produce the object. Our provider
+ * looks up the most specific object factory based on this additional
+ * information. This makes a huge difference when the number of ObjectFactory
+ * instances is large.
+ * <br/>
+ * Eventually, it is highly feasible for generated schemas, to also include
+ * state and object factories for various objectClasses, or domain objects.
+ * This means the number of factories will increase. By associating object and
+ * state factories with their respective objectClasses and Classes we can
+ * integrate these DAOs into the schema subsystem making factory lookups
+ * extremely fast and efficient without costing the user too much to create and
+ * store objects within the directory. At the end of the day the directory
+ * becomes a hierarchical object store where lookup, bind and rebind are the
+ * only operations besides search to access and store objects. That's pretty
+ * PHAT!
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface ServerDirObjectFactory extends DirObjectFactory
+{
+ /**
+ * Gets either the OID for the objectClass or the human readable name for
+ * the objectClass this DirStateFactory is associated with. Note
+ * that associating this factory with an objectClass automatically
+ * associates this DirObjectFactory with all descendents of the objectClass.
+ *
+ * @return the OID or human readable name of the objectClass associated with this ObjectFactory
+ */
+ String getObjectClassId();
+
+ /**
+ * Gets the Class instance associated with this ObjectFactory. Objects to
+ * be created by this ObjectFactory will be of this type, a subclass of
+ * this type, or implement this type if it is an interface.
+ *
+ * @return the Class associated with this factory.
+ */
+ Class getAssociatedClass();
+}
Added: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirStateFactory.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirStateFactory.java?view=auto&rev=149139
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirStateFactory.java (added)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirStateFactory.java Sun Jan 30 10:53:49 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed 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.ldap.server.jndi;
+
+
+import javax.naming.spi.DirStateFactory;
+
+
+/**
+ * A specialized StateFactory that is optimized for our server-side JNDI
+ * provider. This factory reports the id of the objectClass that it
+ * is associated with. This makes it easier for the server side provider to
+ * find the required factory rather than attempt several others within the list
+ * of state factories. JNDI SPI methods are inefficient since they are designed
+ * to try all state factories to produce an object. Our provider looks up
+ * the most specific state factories based on additional information. This
+ * makes a huge difference when the number of StateFactories becomes large.
+ * <br/>
+ * Eventually, it is highly feasible for generated schemas, to also include
+ * state and object factories for various objectClasses. This means the number
+ * of factories will increase. By associating object and state factories with
+ * their respective objectClasses we can integrate this into the schema
+ * subsystem making factory lookups extremely fast and efficient without costing
+ * the user too much to create and store objects within the directory.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface ServerDirStateFactory extends DirStateFactory
+{
+ /**
+ * Gets either the OID for the objectClass or the human readable name for
+ * the objectClass this DirStateFactory is associated with. Note
+ * that associating this factory with an objectClass automatically
+ * associates this DirStateFactory with all descendents of the objectClass.
+ *
+ * @return the OID or human readable name of the objectClass associated with this StateFactory
+ */
+ String getObjectClassId();
+
+ /**
+ * Gets the Class instance associated with this StateFactory. Objects to
+ * be persisted by this StateFactory must be of this type, a subclass of
+ * this type, or implement this type if it is an interface.
+ *
+ * @return the class associated with this factory.
+ */
+ Class getAssociatedClass();
+}