|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.hivemind.internal.ser; |
|
16 |
| |
|
17 |
| import java.io.Externalizable; |
|
18 |
| import java.io.IOException; |
|
19 |
| import java.io.ObjectInput; |
|
20 |
| import java.io.ObjectOutput; |
|
21 |
| |
|
22 |
| import org.apache.hivemind.util.Defense; |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| public class ServiceToken implements Externalizable |
|
33 |
| { |
|
34 |
| private static final long serialVersionUID = 1L; |
|
35 |
| private String _serviceId; |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
1
| public ServiceToken()
|
|
40 |
| { |
|
41 |
| } |
|
42 |
| |
|
43 |
1
| public ServiceToken(String serviceId)
|
|
44 |
| { |
|
45 |
1
| Defense.notNull(serviceId, "serviceId");
|
|
46 |
| |
|
47 |
1
| _serviceId = serviceId;
|
|
48 |
| } |
|
49 |
| |
|
50 |
1
| public String getServiceId()
|
|
51 |
| { |
|
52 |
1
| return _serviceId;
|
|
53 |
| } |
|
54 |
| |
|
55 |
1
| public void writeExternal(ObjectOutput out) throws IOException
|
|
56 |
| { |
|
57 |
1
| out.writeUTF(_serviceId);
|
|
58 |
| } |
|
59 |
| |
|
60 |
1
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
|
|
61 |
| { |
|
62 |
1
| _serviceId = in.readUTF();
|
|
63 |
| } |
|
64 |
| |
|
65 |
1
| Object readResolve()
|
|
66 |
| { |
|
67 |
1
| return ServiceSerializationHelper.getServiceSerializationSupport()
|
|
68 |
| .getServiceFromToken(this); |
|
69 |
| } |
|
70 |
| } |