db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r453366 - /db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java
Date Thu, 05 Oct 2006 20:31:25 GMT
Author: arminw
Date: Thu Oct  5 13:31:25 2006
New Revision: 453366

URL: http://svn.apache.org/viewvc?view=rev&rev=453366
Log:
convert class to wrapper class for string based GUID's

Modified:
    db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java

Modified: db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java?view=diff&rev=453366&r1=453365&r2=453366
==============================================================================
--- db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java (original)
+++ db/ojb/trunk/src/java/org/apache/ojb/broker/util/GUID.java Thu Oct  5 13:31:25 2006
@@ -16,27 +16,17 @@
  */
 
 import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.rmi.server.UID;
 
 /**
- * simple GUID (Globally Unique ID) implementation.
- * A GUID is composed of two parts:
- * 1. The IP-Address of the local machine.
- * 2. A java.rmi.server.UID
+ * A wrapper class for GUID String values.
  *
- * @deprecated will be replaced by {@link GUIDFactory}.
+ * @deprecated 
  * @version $Id$
+ * @see GUIDFactory
  */
 public class GUID implements Serializable
 {
-	static final long serialVersionUID = -6163239155380515945L;
-
-    /**
-     * holds the hostname of the local machine.
-     */
-    private static String localIPAddress;
+    static final long serialVersionUID = -6163239155380515945L;
 
     /**
      * String representation of the GUID
@@ -44,63 +34,36 @@
     private String guid;
 
     /**
-     * compute the local IP-Address
-     */
-    static
-    {
-        try
-        {
-            localIPAddress = InetAddress.getLocalHost().getHostAddress();
-        }
-        catch (UnknownHostException e)
-        {
-            localIPAddress = "localhost";
-        }
-    }
-
-    /**
-     * public no args constructor.
-     */
-    public GUID()
-    {
-        UID uid = new UID();
-        StringBuffer buf = new StringBuffer();
-        buf.append(localIPAddress);
-        buf.append(":");
-        buf.append(uid.toString());
-        guid = buf.toString();
-    }
- 
-    /**
-     * public constructor.
-     * The caller is responsible to feed a globally unique 
+     * The caller is responsible to feed a globally unique
      * String into the theGuidString parameter
+     *
      * @param theGuidString a globally unique String
-     */    
+     */
     public GUID(String theGuidString)
     {
-    	guid = theGuidString;	
+        guid = theGuidString;
     }
 
     /**
-     *  returns the String representation of the GUID
+     * Returns the String representation of the GUID
      */
     public String toString()
     {
         return guid;
     }
+
     /**
      * @see java.lang.Object#equals(Object)
      */
     public boolean equals(Object obj)
     {
-    	if (obj instanceof GUID)
-    	{
-    		if (guid.equals(((GUID) obj).guid))
-    		{
-    			return true;	
-    		}	
-    	}
+        if(obj instanceof GUID)
+        {
+            if(guid.equals(((GUID) obj).guid))
+            {
+                return true;
+            }
+        }
         return false;
     }
 
@@ -111,5 +74,4 @@
     {
         return guid.hashCode();
     }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message