01: /*
02:
03: Derby - Class org.apache.derby.iapi.services.uuid.UUIDFactory
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (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: Create a new UUID. The resulting object is guaranteed
57: to be unique "across space and time".
58: @return The UUID.
59: **/
60: public UUID createUUID();
61:
62: /**
63: Recreate a UUID from a string produced by UUID.toString.
64: @return The UUID.
65: **/
66: public UUID recreateUUID(String uuidstring);
67:
68: /**
69: Recreate a UUID from a byte array produced by UUID.toByteArray.
70: @return The UUID.
71: @see UUID#toByteArray
72: **/
73: public UUID recreateUUID(byte[] b);
74: }
|