You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/12/16 01:54:35 UTC

svn commit: r487742 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/reference/ iapi/services/monitor/ impl/db/ impl/sql/catalog/ impl/sql/compile/ impl/sql/execute/

Author: djd
Date: Fri Dec 15 16:54:35 2006
New Revision: 487742

URL: http://svn.apache.org/viewvc?view=rev&rev=487742
Log:
DERBY-2164 Add some comments to EngineType class and clean up its use.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/EngineType.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/EngineType.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/EngineType.java?view=diff&rev=487742&r1=487741&r2=487742
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/EngineType.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/EngineType.java Fri Dec 15 16:54:35 2006
@@ -21,17 +21,36 @@
 
 package org.apache.derby.iapi.reference;
 
-
-public interface EngineType
-{
-
-	// Cloudscape engine types
-
-	int			STANDALONE_DB			=	0x00000002;	
-	int         STORELESS_ENGINE        =   0x00000080;
-
-	int NONE = STANDALONE_DB;
-
-	String PROPERTY = "derby.engineType";
-
-}
+/**
+ * Derby engine types. Enumerate different modes the
+ * emmbedded engine (JDBC driver, SQL langauge layer and
+ * store) can run in. A module can query the monitor to
+ * see what type of service is being requested in terms
+ * of its engine type and then use that in a decision
+ * as to if it is suitable.
+ * 
+ * @see org.apache.derby.iapi.services.monitor.ModuleSupportable
+ * @see org.apache.derby.iapi.services.monitor.Monitor#isDesiredType(Properties, int)
+ * @see org.apache.derby.iapi.services.monitor.Monitor#getEngineType(Properties)
+ *
+ */
+public interface EngineType {
+    /**
+     * Full database engine, the typical configuration.
+     */
+    int STANDALONE_DB = 0x00000002;
+    
+    /**
+     * A JDBC engine with a query language layer but no
+     * store layer executing. More used a a building block
+     * for functionality built on top of a runtime SQL
+     * engine, such as syntax checking.
+     */
+    int STORELESS_ENGINE = 0x00000080;
+    
+    /**
+     * Property used to define the type of engine required.
+     * If not set defaults to STANDALONE_DB.
+     */
+    String PROPERTY = "derby.engineType";
+}
\ No newline at end of file

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java?view=diff&rev=487742&r1=487741&r2=487742
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/monitor/Monitor.java Fri Dec 15 16:54:35 2006
@@ -733,8 +733,7 @@
 	  */
 	public static boolean isDesiredType(Properties startParams, int desiredProperty )
 	{
-		boolean	retval = false;
-		int		engineType = EngineType.NONE;
+		int		engineType = EngineType.STANDALONE_DB;
 
 		if ( startParams != null )
 		{
@@ -743,8 +742,13 @@
 
 		return (engineType & desiredProperty) != 0;
 	}
-	public static boolean isDesiredType(int engineType, int desiredProperty) {
-		return (engineType & desiredProperty) != 0;
+    
+    /**
+     * Is engineType a match for desiredType. A match exists
+     * if the bit intersect of the two values is no zero.
+     */
+	public static boolean isDesiredType(int engineType, int desiredType) {
+		return (engineType & desiredType) != 0;
 	}
 	
 	/**
@@ -778,7 +782,7 @@
 		boolean plainCreate = Boolean.valueOf(p.getProperty(Attribute.CREATE_ATTR)).booleanValue();
 
 		if (plainCreate) {
-			return (type & EngineType.NONE) != 0;
+			return (type & EngineType.STANDALONE_DB) != 0;
 		}
 
 		// database must already exist

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java?view=diff&rev=487742&r1=487741&r2=487742
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java Fri Dec 15 16:54:35 2006
@@ -141,9 +141,7 @@
 	 */
 
 	public boolean canSupport(Properties startParams) {
-
-		return Monitor.isDesiredCreateType(startParams, org.apache.derby.iapi.reference.EngineType.NONE);
-
+        return Monitor.isDesiredCreateType(startParams, getEngineType());
 	}
 
 	protected Properties allParams;	// properties to be used *only* while booting.
@@ -248,10 +246,13 @@
  	 */
 
 	/**
-	  *	@return	one of the values from EngineType.java:
-	  *
+     * Return the engine type that this Database implementation
+     * supports.
+     * This implementation supports the standard database.
 	  */
-	public	int	getEngineType() { return org.apache.derby.iapi.reference.EngineType.NONE; }
+	public int getEngineType() {
+        return EngineType.STANDALONE_DB;
+    }
 
 	public boolean isReadOnly()
 	{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?view=diff&rev=487742&r1=487741&r2=487742
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Fri Dec 15 16:54:35 2006
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.sql.catalog;
 
+import org.apache.derby.iapi.reference.EngineType;
 import org.apache.derby.iapi.reference.JDBC30Translation;
 import org.apache.derby.iapi.reference.Property;
 import org.apache.derby.iapi.reference.SQLState;
@@ -442,18 +443,15 @@
 
 
 	/**
-	  Currently, all this routine does is check to see if the Replication
-	  property has been turned on for this database. If so, then this is not
-	  the NodeFactory that's wanted--so we return false. The NodeFactory that
-	  is wanted is our child class "RepNodeFactory".
+     * This is the data dictionary implementation for
+     * the standard database engine.
 
-	  @return	true		if this database does not want Replication
-	            false		otherwise
+	  @return true if this service requested is for a database engine.
 	  */
 
 	public boolean canSupport(Properties startParams)
 	{
-		return	Monitor.isDesiredType( startParams, org.apache.derby.iapi.reference.EngineType.NONE );
+        return Monitor.isDesiredType(startParams, EngineType.STANDALONE_DB);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java?view=diff&rev=487742&r1=487741&r2=487742
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java Fri Dec 15 16:54:35 2006
@@ -40,6 +40,7 @@
 import org.apache.derby.iapi.services.property.PropertyUtil;
 
 import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.EngineType;
 import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.catalog.AliasInfo;
@@ -82,9 +83,16 @@
 	//
 	//////////////////////////////////////////////////////////////////////
 
+    /**
+     * Module supports the standard database engine and
+     * a storeless SQL engine. Probably a single NodeFactory
+     * will only ever exist, see DERBY-673, as part of the
+     * compile system.
+     */
 	public boolean canSupport(Properties startParams)
 	{
-		return	Monitor.isDesiredType( startParams, org.apache.derby.iapi.reference.EngineType.NONE );
+		return Monitor.isDesiredType(startParams,
+                EngineType.STANDALONE_DB | EngineType.STORELESS_ENGINE);
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java?view=diff&rev=487742&r1=487741&r2=487742
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericExecutionFactory.java Fri Dec 15 16:54:35 2006
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.sql.execute;
 
+import org.apache.derby.iapi.reference.EngineType;
 import org.apache.derby.iapi.sql.Activation;
 
 import org.apache.derby.impl.sql.GenericColumnDescriptor;
@@ -81,7 +82,8 @@
 	//
 	public boolean canSupport(Properties startParams)
 	{
-		return	Monitor.isDesiredType( startParams, org.apache.derby.iapi.reference.EngineType.NONE);
+        return Monitor.isDesiredType(startParams,
+                EngineType.STANDALONE_DB | EngineType.STORELESS_ENGINE);
 	}
 
 	/**