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 mi...@apache.org on 2005/05/02 17:51:49 UTC

svn commit: r165645 - /incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java

Author: mikem
Date: Mon May  2 08:51:48 2005
New Revision: 165645

URL: http://svn.apache.org/viewcvs?rev=165645&view=rev
Log:
committing this patch for DERBY-235 for suresh.thalamati@gmail.com

Problem was service name on database creation  was getting just set to the canonical name of the database directory
without subsub protocol name added in the beginning. Whereas rest of the system seems to expect that the
subsub protocol name  also is part of the  service  name.  For example if "csf" is  subprotocol name ,
service name should be  "csf:C:\suresht\databases\wombat1" not just "C:\suresht\databases\wombat1".
Attached diff fixes the problem by  prefixing the subsub protocol name  to the canonical name, to generate
the service name in the case of create also.

This was not an issue with default "directory"  subsub protocol because the system consistently generates
the service name as just the canonical name of  the service root.

Another doubt I had while fixing this issue why we generate the service name after creating the service root,
my guess is because of the following comment in the java docs for java.io.File.getCanonicalPath() method:
" Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that
denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a
nonexistent file or directory may be different  from the canonical form of the same pathname after the file or
directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the
canonical form of the same pathname after the file or directory is deleted.
" 


Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java?rev=165645&r1=165644&r2=165645&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java Mon May  2 08:51:48 2005
@@ -629,7 +629,15 @@
 		Throwable t = null;
         try
         {
-            return (String) AccessController.doPrivileged(
+			String protocolLeadIn = "";
+			//prepend the subsub protocol name to the storage factoty canonical
+			//name to form the service name except in case of the the 
+			//default subsubprototcol(PersistentService.DIRECTORY)
+
+			if (!(getType().equals( PersistentService.DIRECTORY))) 
+				protocolLeadIn = getType() + ":";
+
+            return protocolLeadIn + (String) AccessController.doPrivileged(
                 new PrivilegedExceptionAction()
                 {
                     public Object run()