1
1
package com .opentok ;
2
2
3
- import java .util .UUID ;
4
-
5
- import org .codehaus .jackson .map .ObjectMapper ;
3
+ import com .fasterxml .jackson .annotation .JsonCreator ;
4
+ import com .fasterxml .jackson .annotation .JsonProperty ;
5
+ import com .fasterxml .jackson .annotation .JsonValue ;
6
+ import com .fasterxml .jackson .databind .ObjectMapper ;
6
7
7
8
/**
8
9
* Represents an archive of an OpenTok session.
@@ -11,166 +12,131 @@ public class Archive {
11
12
/**
12
13
* Defines values returned by the {@link Archive#getStatus} method.
13
14
*/
14
- public enum ArchiveState {
15
+ public enum Status {
15
16
/**
16
- * The archive file is available for download from the OpenTok cloud. You can get the URL of
17
+ * The archive file is AVAILABLE for download from the OpenTok cloud. You can get the URL of
17
18
* the download file by calling the {@link Archive#getUrl} method.
18
19
*/
19
- available ,
20
+ AVAILABLE ,
20
21
/**
21
- * The archive file has been deleted .
22
+ * The archive file has been DELETED .
22
23
*/
23
- deleted ,
24
+ DELETED ,
24
25
/**
25
- * The recording of the archive failed .
26
+ * The recording of the archive FAILED .
26
27
*/
27
- failed ,
28
+ FAILED ,
28
29
/**
29
- * The archive recording has started and is in progress.
30
+ * The archive recording has STARTED and is in progress.
30
31
*/
31
- started ,
32
+ STARTED ,
32
33
/**
33
- * The archive recording has stopped , but the file is not available .
34
+ * The archive recording has STOPPED , but the file is not AVAILABLE .
34
35
*/
35
- stopped ,
36
+ STOPPED ,
36
37
/**
37
- * The archive file is available at the target S3 bucket you specified using the
38
+ * The archive file is AVAILABLE at the target S3 bucket you specified using the
38
39
* REST API.
39
40
*/
40
- uploaded ,
41
- /**
42
- * The archive status is unknown.
43
- */
44
- unknown
41
+ UPLOADED ;
42
+
43
+ @ JsonValue public String toString () {
44
+ return super . toString (). toLowerCase ();
45
+ }
45
46
}
46
47
47
- private long createdAt = System . currentTimeMillis () ;
48
- private int duration = 0 ;
49
- private UUID id ;
50
- private String name ;
51
- private int partnerId ;
52
- private String reason = "" ;
53
- private String sessionId ;
54
- private int size = 0 ;
55
- private ArchiveState status = ArchiveState . unknown ;
56
- private String url ;
48
+ @ JsonProperty private long createdAt ;
49
+ @ JsonProperty private int duration = 0 ;
50
+ @ JsonProperty private String id ;
51
+ @ JsonProperty private String name ;
52
+ @ JsonProperty private int partnerId ;
53
+ @ JsonProperty private String reason ;
54
+ @ JsonProperty private String sessionId ;
55
+ @ JsonProperty private int size = 0 ;
56
+ @ JsonProperty private Status status ;
57
+ @ JsonProperty private String url ;
57
58
58
59
protected Archive () {
59
60
}
60
61
62
+ @ JsonCreator
63
+ public static Archive makeArchive () {
64
+ return new Archive ();
65
+ }
66
+
61
67
/**
62
68
* The time at which the archive was created, in milliseconds since the UNIX epoch.
63
69
*/
64
70
public long getCreatedAt () {
65
71
return createdAt ;
66
72
}
67
73
68
- public void setCreatedAt (long createdAt ) {
69
- this .createdAt = createdAt ;
70
- }
71
-
72
74
/**
73
75
* The duration of the archive, in milliseconds.
74
76
*/
75
77
public int getDuration () {
76
78
return duration ;
77
79
}
78
80
79
- public void setDuration (int duration ) {
80
- this .duration = duration ;
81
- }
82
-
83
81
/**
84
82
* The archive ID.
85
83
*/
86
- public UUID getId () {
84
+ public String getId () {
87
85
return id ;
88
86
}
89
87
90
- public void setId (UUID id ) {
91
- this .id = id ;
92
- }
93
-
94
88
/**
95
89
* The name of the archive.
96
90
*/
97
91
public String getName () {
98
92
return name ;
99
93
}
100
94
101
- public void setName (String name ) {
102
- this .name = name ;
103
- }
104
-
105
95
/**
106
96
* The OpenTok API key associated with the archive.
107
97
*/
108
98
public int getPartnerId () {
109
99
return partnerId ;
110
100
}
111
101
112
- public void setPartnerId (int partnerId ) {
113
- this .partnerId = partnerId ;
114
- }
115
-
116
102
/**
117
- * For archives with the status "stopped ", this can be set to "90 mins exceeded", "failure", "session ended",
118
- * or "user initiated". For archives with the status "failed ", this can be set to "system failure".
103
+ * For archives with the status "STOPPED ", this can be set to "90 mins exceeded", "failure", "session ended",
104
+ * or "user initiated". For archives with the status "FAILED ", this can be set to "system failure".
119
105
*/
120
106
public String getReason () {
121
107
return reason ;
122
108
}
123
109
124
- public void setReason (String reason ) {
125
- this .reason = reason ;
126
- }
127
-
128
110
/**
129
111
* The session ID of the OpenTok session associated with this archive.
130
112
*/
131
113
public String getSessionId () {
132
114
return sessionId ;
133
115
}
134
116
135
- public void setSessionId (String sessionId ) {
136
- this .sessionId = sessionId ;
137
- }
138
-
139
117
/**
140
118
* The size of the MP4 file. For archives that have not been generated, this value is set to 0.
141
119
*/
142
120
public int getSize () {
143
121
return size ;
144
122
}
145
123
146
- public void setSize (int size ) {
147
- this .size = size ;
148
- }
149
-
150
124
/**
151
- * The status of the archive, as defined by the {@link ArchiveState } enum.
125
+ * The status of the archive, as defined by the {@link com.opentok.Archive.Status } enum.
152
126
*/
153
- public ArchiveState getStatus () {
127
+ public Status getStatus () {
154
128
return status ;
155
129
}
156
130
157
- public void setStatus (ArchiveState status ) {
158
- this .status = status ;
159
- }
160
-
161
131
/**
162
- * The download URL of the available MP4 file. This is only set for an archive with the status set to "available ";
163
- * for other archives, (including archives wit the status "uploaded ") this method returns null. The download URL is
164
- * obfuscated, and the file is only available from the URL for 10 minutes. To generate a new URL, call
132
+ * The download URL of the AVAILABLE MP4 file. This is only set for an archive with the status set to "AVAILABLE ";
133
+ * for other archives, (including archives wit the status "UPLOADED ") this method returns null. The download URL is
134
+ * obfuscated, and the file is only AVAILABLE from the URL for 10 minutes. To generate a new URL, call
165
135
* the {@link com.opentok.OpenTok#listArchives()} or {@link com.opentok.OpenTok#getArchive(String)} method.
166
136
*/
167
137
public String getUrl () {
168
138
return url ;
169
139
}
170
-
171
- public void setUrl (String url ) {
172
- this .url = url ;
173
- }
174
140
175
141
// public Archive stop() throws OpenTokException {
176
142
// HashMap<String, String> headers = new HashMap<String, String>();
0 commit comments