KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > services > uuid > UUIDFactory


1 /*
2
3    Derby - Class org.apache.derby.iapi.services.uuid.UUIDFactory
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.services.uuid;
23
24 import org.apache.derby.catalog.UUID;
25
26 /*
27     Internal comment (not for user documentation):
28   Although this is an abstract interface, I believe that the
29   underlying implementation of UUID will have to be DCE UUID.
30   This is because the string versions of UUIDs get stored in
31   the source code. In other words, no matter what implementation
32   is used for UUIDs, strings that look like this
33   <blockquote><pre>
34     E4900B90-DA0E-11d0-BAFE-0060973F0942
35   </blockquote></pre>
36   will always have to be turned into universally unique objects
37   by the recreateUUID method
38  */

39 /**
40     
41   Generates and recreates unique identifiers.
42   
43   An example of such an identifier is:
44   <blockquote><pre>
45     E4900B90-DA0E-11d0-BAFE-0060973F0942
46   </blockquote></pre>
47   These resemble DCE UUIDs, but use a different implementation.
48   <P>
49   The string format is designed to be the same as the string
50   format produced by Microsoft's UUIDGEN program, although at
51   present the bit fields are probably not the same.
52   
53  **/

54 public interface UUIDFactory
55 {
56     /**
57       Create a new UUID. The resulting object is guaranteed
58       to be unique "across space and time".
59       @return The UUID.
60     **/

61     public UUID createUUID();
62
63     /**
64       Recreate a UUID from a string produced by UUID.toString.
65       @return The UUID.
66     **/

67     public UUID recreateUUID(String JavaDoc uuidstring);
68
69     /**
70       Recreate a UUID from a byte array produced by UUID.toByteArray.
71       @return The UUID.
72       @see UUID#toByteArray
73     **/

74     public UUID recreateUUID(byte[] b);
75 }
76
77
Popular Tags