Magnus ?or Torfason wrote:

> I'm wondering if there is somewhere in Turbine an implementation of UUID's
> (Universally Unique Identifiers)?
 
> I really need to generate such ID's, and if it does not exist, I would like
> to write a generator and contribute it.  One showstopper, I've not seen a
> way to get access to the MAC address of an ethernet card from Java.
> java.net seems to know nothing about the layers beneath IP.
> 
> the layout of a UUID is like this (node ID is the MAC adress):

That's really interesting. I had the need for an unique indetifier for
a Turbine instance, and wrote a service that handles that.
Plase consult JavaDocs for org.apache.turbine.services.uniqueid package.

I didn't know about UUID, so I had to make something up. I noticed that
the URL that your application is accessed through makes a very good 
world unique indetifier for your application. To normalize it a little bit
I calculated an MD5 sum of this URL. Of course it has a 1:2^128 chance
that different URLs get the same ID, but I think we can live with that :)

I don't think that there is a portable way of querying the MAC address
from under JAVA. This is very system dependent. But even if it was 
possible, please consider that multiple application can run on a machine
that has one Ethernet interface assigned multiple IPs (IP aliasing).
Therefore MAC is not a good identifier anyways.

Rafal

PS. The URL I use includes schema,host,port(if nonstandard),context and servlet name


------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to