1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.beep4j.internal;
17
18 import java.util.HashSet;
19 import java.util.Set;
20
21 import net.sf.beep4j.StartSessionRequest;
22 import net.sf.beep4j.internal.util.Assert;
23
24
25
26
27
28
29 public class DefaultStartSessionRequest implements StartSessionRequest {
30
31 private final Set<String> profiles = new HashSet<String>();
32
33 private boolean cancellable;
34
35 private boolean cancelled;
36
37 private int code;
38
39 private String message;
40
41 public DefaultStartSessionRequest(boolean cancellable) {
42 this.cancellable = cancellable;
43 }
44
45 public boolean isCancellable() {
46 return cancellable;
47 }
48
49 public boolean isCancelled() {
50 return cancelled;
51 }
52
53 public int getReplyCode() {
54 return code;
55 }
56
57 public String getMessage() {
58 return message;
59 }
60
61 public String[] getProfiles() {
62 return profiles.toArray(new String[profiles.size()]);
63 }
64
65 public void cancel() {
66 this.cancelled = true;
67 this.code = 421;
68 this.message = "service not available";
69 }
70
71 public void registerProfile(String profileUri) {
72 Assert.notNull("profileUri", profileUri);
73 profiles.add(profileUri);
74 }
75
76 }