KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > webflow > util > RandomGuidUidGenerator


1 /*
2  * Copyright 2002-2006 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.springframework.webflow.util;
17
18 import java.io.Serializable JavaDoc;
19
20 /**
21  * A key generator that uses the RandomGuid support class. The default
22  * implementation used by the webflow system.
23  *
24  * @author Keith Donald
25  */

26 public class RandomGuidUidGenerator implements UidGenerator, Serializable JavaDoc {
27
28     /**
29      * Should the random GUID generated be secure?
30      */

31     private boolean secure;
32
33     /**
34      * Returns whether or not the generated random numbers are
35      * <i>secure</i>, meaning cryptographically strong.
36      */

37     public boolean isSecure() {
38         return secure;
39     }
40
41     /**
42      * Sets whether or not the generated random numbers should be
43      * <i>secure</i>. If set to true, generated GUIDs are cryptographically
44      * strong.
45      */

46     public void setSecure(boolean secure) {
47         this.secure = secure;
48     }
49
50     public Serializable JavaDoc generateUid() {
51         return new RandomGuid(secure).toString();
52     }
53
54     public Serializable JavaDoc parseUid(String JavaDoc encodedUid) {
55         return encodedUid;
56     }
57 }
Popular Tags