db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r474376 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/store/access/ impl/sql/execute/ impl/store/raw/data/
Date Mon, 13 Nov 2006 15:50:25 GMT
Author: djd
Date: Mon Nov 13 07:50:24 2006
New Revision: 474376

URL: http://svn.apache.org/viewvc?view=rev&rev=474376
Log:
DERBY-537 (partial) Remove some dead code for handling jar files stored within the database.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AddJarConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropJarConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarDDL.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ReplaceJarConstantAction.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java Mon
Nov 13 07:50:24 2006
@@ -22,7 +22,6 @@
 package org.apache.derby.iapi.store.access;
 
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.store.access.DatabaseInstant;
 import org.apache.derby.io.StorageFile;
 
 import java.io.FileNotFoundException;
@@ -84,13 +83,10 @@
 	  the database.
 
 	  @param name the name of the fileResource to remove.
-	  @param purgeOnCommit true means purge the fileResource 
-	         when the current transaction commits. false means retain
-	         the file resource for use by replication. 
 	  
 	  @exception StandardException some error occured.
 	  */
-	public void remove(String name, long currentGenerationId, boolean purgeOnCommit)
+	public void remove(String name, long currentGenerationId)
 		throws StandardException;
 
 	/**
@@ -101,14 +97,11 @@
 	  @param name the name of the file resource.
 	  @param source an input stream for reading the content of
 	  the file resource.
-	  @param purgeOnCommit true means purge the existing version of
-	         fileResource when the current transaction commits. false 
-	         means retain the existing version for use by replication. 
 	  @return the generationId for the new 'current' version of the
 	          file resource. 
 	  @exception StandardException some error occured.
 	*/
-	public long replace(String name, long currentGenerationId, InputStream source,boolean purgeOnCommit)
+	public long replace(String name, long currentGenerationId, InputStream source)
 		throws StandardException;
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AddJarConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AddJarConstantAction.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AddJarConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/AddJarConstantAction.java
Mon Nov 13 07:50:24 2006
@@ -33,8 +33,6 @@
  */
 class AddJarConstantAction extends DDLConstantAction
 {
-
-	private final UUID id;
 	private	final String schemaName;
 	private	final String sqlName;
 	private final String externalPath;
@@ -53,12 +51,11 @@
 	 *	@param	sqlName			    The sqlName for the jar file.
 	 *  @param  externalPath            The name of the file that holds the jar.
 	 */
-	AddJarConstantAction(UUID id,
+	AddJarConstantAction(
 								 String schemaName,
 								 String sqlName,
 								 String externalPath)
 	{
-		this.id = id;
 		this.schemaName = schemaName;
 		this.sqlName = sqlName;
 		this.externalPath = externalPath;
@@ -92,7 +89,7 @@
 	public void	executeConstantAction( Activation activation )
 						throws StandardException
 	{
-		JarUtil.add(id,schemaName,sqlName,externalPath);
+		JarUtil.add(schemaName,sqlName,externalPath);
 	}
 
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropJarConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropJarConstantAction.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropJarConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/DropJarConstantAction.java
Mon Nov 13 07:50:24 2006
@@ -35,8 +35,6 @@
  */
 class DropJarConstantAction extends DDLConstantAction
 {
-
-	private final UUID id;
 	private final String schemaName;
 	private final String sqlName;
 
@@ -49,15 +47,12 @@
 	/**
 	 *	Make the ConstantAction to drop a jar file to database.
 	 *
-	 *	@param	id					The id for the jar file
 	 *	@param	schemaName			The SchemaName for the jar file.
 	 *	@param	sqlName			    The sqlName for the jar file.
 	 */
-	DropJarConstantAction(UUID id,
-								  String schemaName,
+	DropJarConstantAction(String schemaName,
 								  String sqlName)
 	{
-		this.id = id;
 		this.schemaName = schemaName;
 		this.sqlName = sqlName;
 	}
@@ -90,13 +85,6 @@
 	public void	executeConstantAction( Activation activation )
 						throws StandardException
 	{
-		JarUtil.drop(null,schemaName,sqlName,
-					 purgeOnCommit());
+		JarUtil.drop(schemaName,sqlName);
 	}
-
-	//
-	// Replication can over-ride this to defer purging dropped jar
-	// files that remain in the stage.
-	protected boolean purgeOnCommit() { return true; }
-
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java
Mon Nov 13 07:50:24 2006
@@ -815,57 +815,51 @@
 	/**
 	 * Make the ConstantAction to Add a jar file to a database.
 	 *
-	 *	@param	id					The id for the jar file -
-	 *                              (null means create one)
 	 *	@param	schemaName			The SchemaName for the jar file.
 	 *	@param	sqlName			    The sqlName for the jar file.
 	 *  @param  externalPath            The name of the file that holds the jar.
 	 *  @exception StandardException Ooops
 	 */
-	public	ConstantAction getAddJarConstantAction(UUID id,
+	public	ConstantAction getAddJarConstantAction(
 														 String schemaName,
 														 String sqlName,
 														 String externalPath)
 		 throws StandardException
 	{
 		getAuthorizer().authorize(Authorizer.JAR_WRITE_OP);
-		return new AddJarConstantAction(id,schemaName,sqlName,externalPath);
+		return new AddJarConstantAction(schemaName,sqlName,externalPath);
 	}
 	/**
 	 * Make the ConstantAction to replace a jar file in a database.
 	 *
-	 *	@param	id					The id for the jar file -
-	 *                              (Ignored if null)
 	 *	@param	schemaName			The SchemaName for the jar file.
 	 *	@param	sqlName			    The sqlName for the jar file.
 	 *  @param  externalPath            The name of the file that holds the new jar.
 	 *  @exception StandardException Ooops
 	 */
-	public	ConstantAction getReplaceJarConstantAction(UUID id,
+	public	ConstantAction getReplaceJarConstantAction(
 														 String schemaName,
 														 String sqlName,
 														 String externalPath)
 		 throws StandardException
 	{
 		getAuthorizer().authorize(Authorizer.JAR_WRITE_OP);
-		return new ReplaceJarConstantAction(id,schemaName,sqlName,externalPath);
+		return new ReplaceJarConstantAction(schemaName,sqlName,externalPath);
 	}
 	/**
 	 * Make the ConstantAction to drop a jar file from a database.
 	 *
-	 *	@param	id					The id for the jar file -
-	 *                              (Ignored if null)
 	 *	@param	schemaName			The SchemaName for the jar file.
 	 *	@param	sqlName			    The sqlName for the jar file.
 	 *  @exception StandardException Ooops
 	 */
-	public	ConstantAction getDropJarConstantAction(UUID id,
+	public	ConstantAction getDropJarConstantAction(
 														  String schemaName,
 														  String sqlName)
 		 throws StandardException
 	{
 		getAuthorizer().authorize(Authorizer.JAR_WRITE_OP);
-		return new DropJarConstantAction(id,schemaName,sqlName);
+		return new DropJarConstantAction(schemaName,sqlName);
 	}
 
 	static protected Authorizer getAuthorizer()

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarDDL.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarDDL.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarDDL.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarDDL.java Mon Nov
13 07:50:24 2006
@@ -43,7 +43,7 @@
 
 		GenericConstantActionFactory caf = getConstantActionFactory();
 		ConstantAction ca =
-			caf.getAddJarConstantAction(null,schemaName,sqlName,externalPath);
+			caf.getAddJarConstantAction(schemaName,sqlName,externalPath);
 		ca.executeConstantAction(null);
 	}
 
@@ -61,7 +61,7 @@
 
 		GenericConstantActionFactory caf = getConstantActionFactory();
 		ConstantAction ca =
-			caf.getDropJarConstantAction(null,schemaName,sqlName);
+			caf.getDropJarConstantAction(schemaName,sqlName);
 		ca.executeConstantAction(null);
 	}
 
@@ -79,7 +79,7 @@
 
 		GenericConstantActionFactory caf = getConstantActionFactory();
 		ConstantAction ca =
-			caf.getReplaceJarConstantAction(null,schemaName,sqlName,externalPath);
+			caf.getReplaceJarConstantAction(schemaName,sqlName,externalPath);
 		ca.executeConstantAction(null);
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/JarUtil.java Mon Nov
13 07:50:24 2006
@@ -53,7 +53,6 @@
 {
 	//
 	//State passed in by the caller
-	private UUID id; //For add null means create a new id.
 	private String schemaName;
 	private String sqlName;
 
@@ -65,10 +64,9 @@
 	
 	//
 	//State derived from the caller's context
-	private JarUtil(UUID id, String schemaName, String sqlName)
+	private JarUtil(String schemaName, String sqlName)
 		 throws StandardException
 	{
-		this.id = id;
 		this.schemaName = schemaName;
 		this.sqlName = sqlName;
 
@@ -91,10 +89,10 @@
 	  @exception StandardException Opps
 	  */
 	static long
-	add(UUID id, String schemaName, String sqlName, String externalPath)
+	add(String schemaName, String sqlName, String externalPath)
 		 throws StandardException
 	{
-		JarUtil jutil = new JarUtil(id, schemaName, sqlName);
+		JarUtil jutil = new JarUtil(schemaName, sqlName);
 		InputStream is = null;
 		
 		try {
@@ -138,7 +136,7 @@
 
             long generationId = setJar(jarExternalName, is);
 
-            fid = ddg.newFileInfoDescriptor(id, sd, sqlName, generationId);
+            fid = ddg.newFileInfoDescriptor(/*DJD*/null, sd, sqlName, generationId);
             dd.addDescriptor(fid, sd, DataDictionary.SYSFILES_CATALOG_NUM,
                     false, lcc.getTransactionExecute());
             return generationId;
@@ -164,11 +162,11 @@
      *                Opps
      */
 	static void
-	drop(UUID id, String schemaName, String sqlName,boolean purgeOnCommit)
+	drop(String schemaName, String sqlName)
 		 throws StandardException
 	{
-		JarUtil jutil = new JarUtil(id, schemaName,sqlName);
-		jutil.drop(purgeOnCommit);
+		JarUtil jutil = new JarUtil(schemaName,sqlName);
+		jutil.drop();
 	}
 
 	/**
@@ -177,12 +175,10 @@
 	  <P> The reason for dropping  the jar file in this private instance
 	  method is that it allows us to share set up logic with add and
 	  replace.
-	  @param purgeOnCommit True means purge the old jar file on commit. False
-	    means leave it around for use by replication.
 
 	  @exception StandardException Opps
 	  */
-	private void drop(boolean purgeOnCommit) throws StandardException
+	private void drop() throws StandardException
 	{
 		//
 		//Like create table we say we are writing before we read the dd
@@ -191,15 +187,6 @@
 		if (fid == null)
 			throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);
 
-		if (SanityManager.DEBUG)
-		{
-			if (id != null && !fid.getUUID().equals(id))
-			{
-				SanityManager.THROWASSERT("Drop id mismatch want="+id+
-						" have "+fid.getUUID());
-			}
-		}
-
 		String dbcp_s = PropertyUtil.getServiceProperty(lcc.getTransactionExecute(),Property.DATABASE_CLASSPATH);
 		if (dbcp_s != null)
 		{
@@ -231,7 +218,7 @@
 			dd.dropFileInfoDescriptor(fid);
 
 			fr.remove(JarDDL.mkExternalName(schemaName, sqlName, fr.getSeparatorChar()),
-				fid.getGenerationId(), true /*purgeOnCommit*/);
+				fid.getGenerationId());
 		} finally {
 			notifyLoader(true);
 		}
@@ -242,29 +229,26 @@
 	  external file. 
 
 
-	  @param id The id for the jar file we add. Ignored if null.
 	  @param schemaName the name for the schema that holds the jar file.
 	  @param sqlName the sql name for the jar file.
 	  @param externalPath the path for the jar file to add.
-	  @param purgeOnCommit True means purge the old jar file on commit. False
-	    means leave it around for use by replication.
 	  @return The new generationId for the jar file we replace.
 
 	  @exception StandardException Opps
 	  */
 	static long
-	replace(UUID id,String schemaName, String sqlName,
-			String externalPath,boolean purgeOnCommit)
+	replace(String schemaName, String sqlName,
+			String externalPath)
 		 throws StandardException
 	{
-		JarUtil jutil = new JarUtil(id,schemaName,sqlName);
+		JarUtil jutil = new JarUtil(schemaName,sqlName);
 		InputStream is = null;
 		
 
 		try {
 			is = openJarURL(externalPath);
 
-			return jutil.replace(is,purgeOnCommit);
+			return jutil.replace(is);
 		} catch (java.io.IOException fnfe) {
 			throw StandardException.newException(SQLState.SQLJ_INVALID_JAR, fnfe, externalPath);
 		}
@@ -286,7 +270,7 @@
 	    means leave it around for use by replication.
 	  @exception StandardException Opps
 	  */
-	private long replace(InputStream is,boolean purgeOnCommit) throws StandardException
+	private long replace(InputStream is) throws StandardException
 	{
 		//
 		//Like create table we say we are writing before we read the dd
@@ -298,15 +282,6 @@
 		if (fid == null)
 			throw StandardException.newException(SQLState.LANG_FILE_DOES_NOT_EXIST, sqlName,schemaName);
 
-		if (SanityManager.DEBUG)
-		{
-			if (id != null && !fid.getUUID().equals(id))
-			{
-				SanityManager.THROWASSERT("Replace id mismatch want="+
-					id+" have "+fid.getUUID());
-			}
-		}
-
 		try {
 			// disable loads from this jar
 			notifyLoader(false);
@@ -319,7 +294,7 @@
 			//Replace the file.
 			long generationId = 
 				fr.replace(jarExternalName,
-					fid.getGenerationId(), is, purgeOnCommit);
+					fid.getGenerationId(), is);
 
 			//
 			//Re-add the descriptor to the data dictionary.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ReplaceJarConstantAction.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ReplaceJarConstantAction.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ReplaceJarConstantAction.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/ReplaceJarConstantAction.java
Mon Nov 13 07:50:24 2006
@@ -21,21 +21,15 @@
 
 package org.apache.derby.impl.sql.execute;
 
-import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.sql.execute.ConstantAction;
-
 import org.apache.derby.iapi.sql.Activation;
-
-import org.apache.derby.catalog.UUID;
+import org.apache.derby.iapi.sql.execute.ConstantAction;
 /**
  *	Constant action to Add an external  Jar file to a database. 
  *
  */
 class ReplaceJarConstantAction extends DDLConstantAction
 {
-
-	private final UUID id;
 	private final String schemaName;
 	private final String sqlName;
 	private final String externalPath;
@@ -48,17 +42,15 @@
 	/**
 	 *	Make the ConstantAction to replace a jar file in a database.
 	 *
-	 *	@param	id					The id for the jar file
 	 *	@param	schemaName			The SchemaName for the jar file.
 	 *	@param	sqlName			    The sqlName for the jar file.
 	 *  @param  externalPath            The name of the file that holds the jar.
 	 */
-	ReplaceJarConstantAction(UUID id,
+	ReplaceJarConstantAction(
 									String schemaName,
 									String sqlName,
 									String externalPath)
 	{
-		this.id = id;
 		this.schemaName = schemaName;
 		this.sqlName = sqlName;
 		this.externalPath = externalPath;
@@ -89,15 +81,8 @@
 	public void	executeConstantAction( Activation activation )
 						throws StandardException
 	{
-		JarUtil.replace(id,schemaName,
+		JarUtil.replace(schemaName,
 									   sqlName,
-									   externalPath,
-									   purgeOnCommit());
+									   externalPath);
 	}
-
-	//
-	// Replication can over-ride this to defer purging dropped jar
-	// files that remain in the stage.
-	protected boolean purgeOnCommit() { return true; }
-
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java?view=diff&rev=474376&r1=474375&r2=474376
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java Mon
Nov 13 07:50:24 2006
@@ -46,9 +46,9 @@
 
 class RFResource implements FileResource {
 
-	protected final BaseDataFileFactory factory;
+	private final BaseDataFileFactory factory;
 
-	public RFResource(BaseDataFileFactory dataFactory) {
+	RFResource(BaseDataFileFactory dataFactory) {
 		this.factory = dataFactory;
 	}
 
@@ -148,7 +148,7 @@
 	  @see FileResource#remove
 	  @exception StandardException Oops
 	  */
-	public void remove(String name, long currentGenerationId, boolean purgeOnCommit)
+	public void remove(String name, long currentGenerationId)
 		throws StandardException
 	{
 		if (factory.isReadOnly())
@@ -171,27 +171,24 @@
 
         tran.blockBackup(true);
 
-		tran.logAndDo(new RemoveFileOperation(name, currentGenerationId, purgeOnCommit));
+		tran.logAndDo(new RemoveFileOperation(name, currentGenerationId, true));
 
-		if (purgeOnCommit) {
+		Serviceable s = new RemoveFile(getAsFile(name, currentGenerationId));
 
-			Serviceable s = new RemoveFile(getAsFile(name, currentGenerationId));
-
-			tran.addPostCommitWork(s);
-		}
+	    tran.addPostCommitWork(s);
 	}
 
 	/**
 	  @see FileResource#replace
 	  @exception StandardException Oops
 	  */
-	public long replace(String name, long currentGenerationId, InputStream source, boolean purgeOnCommit)
+	public long replace(String name, long currentGenerationId, InputStream source)
 		throws StandardException
 	{
 		if (factory.isReadOnly())
 			throw StandardException.newException(SQLState.FILE_READ_ONLY);
 
-		remove(name, currentGenerationId, purgeOnCommit);
+		remove(name, currentGenerationId);
 
 		long generationId = add(name, source);
 
@@ -207,14 +204,6 @@
 		String versionedFileName = factory.getVersionedName(name, generationId);
 
 		return factory.storageFactory.newStorageFile( versionedFileName);
-	}
-
-	/**
-	  @see FileResource#getAsFile
-	  */
-	private StorageFile getAsFile(String name)
-	{
-		return factory.storageFactory.newStorageFile( name);
 	}
 
 	/**



Mime
View raw message