1
2
3
4
5
6
7
8
9
10
11 package org.astrogrid.applications.manager.idgen;
12
13 import org.astrogrid.component.descriptor.ComponentDescriptor;
14
15 import junit.framework.Test;
16
17 /*** simplest possible memory-only id generator.
18 * <p>
19 * Not to be used in production - ids are only unique through lifetime of single JVM.
20 * @author Noel Winstanley nw@jb.man.ac.uk 27-May-2004
21 *
22 */
23 public class InMemoryIdGen implements IdGen, ComponentDescriptor {
24 /*** Construct a new InMemoryIdGen
25 *
26 */
27 public InMemoryIdGen() {
28 super();
29 }
30 private int i = 0;
31
32 public synchronized String getNewID() {
33 return Integer.toString(++i);
34 }
35 /***
36 * @see org.astrogrid.component.descriptor.ComponentDescriptor#getName()
37 */
38 public String getName() {
39 return "In Memory ID Gen";
40 }
41 /***
42 * @see org.astrogrid.component.descriptor.ComponentDescriptor#getDescription()
43 */
44 public String getDescription() {
45 return "Simplest possible IDGen. not for use in production environments";
46 }
47 /***
48 * @see org.astrogrid.component.descriptor.ComponentDescriptor#getInstallationTest()
49 */
50 public Test getInstallationTest() {
51 return null;
52 }
53 }
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77