01: package org.bpmscript.web;
02:
03: import java.util.UUID;
04:
05: import org.springframework.beans.factory.FactoryBean;
06:
07: public class PeerUrlFactoryBean implements FactoryBean {
08:
09: private String prefix = null;
10: private String group = "default";
11: private boolean persistent = false;
12:
13: public Object getObject() throws Exception {
14: String uuid = UUID.randomUUID().toString();
15: if (prefix != null) {
16: return "peer://" + group + "/" + prefix + uuid
17: + "?persistent=" + Boolean.toString(persistent);
18: } else {
19: return "peer://" + group + "/" + uuid + "?persistent="
20: + Boolean.toString(persistent);
21: }
22: }
23:
24: public Class getObjectType() {
25: return String.class;
26: }
27:
28: public boolean isSingleton() {
29: return false;
30: }
31:
32: public String getPrefix() {
33: return prefix;
34: }
35:
36: public void setPrefix(String prefix) {
37: this .prefix = prefix;
38: }
39:
40: public void setGroup(String group) {
41: this .group = group;
42: }
43:
44: public void setPersistent(boolean persistent) {
45: this.persistent = persistent;
46: }
47:
48: }
|