was breaking my head over a methodology to come up with a unique identifier for storing entries in a LDAP server. Entries stored in the system could have been sourced from varied applicates and datasources, and the probability of entries having the same unique identifier as another entry sources from another system was very high. Initially I
thought of using the conventional Social security Number, but then I
learnt that SSN's were not unique. I
also toggled thoughts between using sequential numbers, first, middle and last name combinations etc. After all the thought I
wondered if others never encountered such issues when having to provision systems from varied sources and ensuring that all sources sent a unique identifier when performing the addition to the LDAP server?
So after all the brain racking I came up with a probable neat way of ensuring that the numbers were unique using JNI!!. I wrote a simple "C" API that concatenated the MAC address of the machine with the EPOC timestamp and the time since last reboot in nanoseconds. This have me a 16 bit number that was unique to the nanosecond. Well, I have a unique identifier now, But how could I use it was my next hurdle.
After a little more pondering (googling and discussing approach methodologies with friends), I realized that with JNI available, life of bridging the gap between java and native code was made much simpler.
I used the tutorial written by Beth Sterns to build my JNI Interface. So if any of you out there ponder on how to use and build JNI interfaces, I'd recommend the Beth Sterns Tutorial anyday !!!. It sure did make my life easy, and I bet it would do the same to yours too..
There also is a MAC OS Runtime for thos MAC geeks.
"Note that the ability to load dynamic libraries is subject to approval by the current security manager. When working with native methods, you must load dynamic libraries. Some applets may not be able to use native methods because the browser or viewer they are running in restricts the ability to load dynamic libraries. See Security Restrictions for information about the security restrictions placed on applets. "