View Javadoc
1   /*
2    * Licensed to The Apereo Foundation under one or more contributor license
3    * agreements. See the NOTICE file distributed with this work for additional
4    * information regarding copyright ownership.
5    *
6    *
7    * The Apereo Foundation licenses this file to you under the Educational
8    * Community License, Version 2.0 (the "License"); you may not use this file
9    * except in compliance with the License. You may obtain a copy of the License
10   * at:
11   *
12   *   http://opensource.org/licenses/ecl2.txt
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   *
20   */
21  
22  package org.opencastproject.fileupload.api.job;
23  
24  import org.opencastproject.mediapackage.MediaPackage;
25  import org.opencastproject.mediapackage.MediaPackageElementFlavor;
26  
27  import java.net.URL;
28  
29  import javax.xml.bind.annotation.XmlAccessType;
30  import javax.xml.bind.annotation.XmlAccessorType;
31  import javax.xml.bind.annotation.XmlElement;
32  import javax.xml.bind.annotation.XmlRootElement;
33  import javax.xml.bind.annotation.XmlType;
34  
35  /**
36   * A class representing the information about the payload of an upload job.
37   *
38   */
39  @XmlType(name = "payload", namespace = "http://fileupload.opencastproject.org")
40  @XmlRootElement(name = "payload", namespace = "http://fileupload.opencastproject.org")
41  @XmlAccessorType(XmlAccessType.NONE)
42  public class Payload {
43  
44    @XmlElement(name = "filename")
45    private String filename; // name of the uploaded file
46    @XmlElement(name = "totalsize")
47    private long totalsize; // size of the file
48    @XmlElement(name = "currentsize")
49    private long currentsize; // number of bytes that have already been (successfully) received
50    @XmlElement(name = "url")
51    private URL url; // URL of the completely uploaded file
52    @XmlElement(name = "mediapackage", namespace = "http://mediapackage.opencastproject.org")
53    private MediaPackage mediapackage; // the mediapackage this UploadJob should belong to
54    @XmlElement(name = "flavor")
55    private MediaPackageElementFlavor flavor;
56  
57    public Payload() {
58      this.filename = "unknown";
59      this.totalsize = -1;
60      this.currentsize = 0;
61      this.mediapackage = null;
62      this.flavor = null;
63    }
64  
65    public Payload(String filename, long size, MediaPackage mp, MediaPackageElementFlavor flavor) {
66      this.filename = filename;
67      this.totalsize = size;
68      this.currentsize = 0;
69      this.mediapackage = mp;
70      this.flavor = flavor;
71    }
72  
73    public String getFilename() {
74      return filename;
75    }
76  
77    public long getTotalSize() {
78      return totalsize;
79    }
80  
81    public void setTotalSize(long totalsize) {
82      this.totalsize = totalsize;
83    }
84  
85    public long getCurrentSize() {
86      return currentsize;
87    }
88  
89    public void setCurrentSize(long size) {
90      this.currentsize = size;
91    }
92  
93    public MediaPackage getMediaPackage() {
94      return this.mediapackage;
95    }
96  
97    public void setMediaPackage(MediaPackage mp) {
98      this.mediapackage = mp;
99    }
100 
101   public MediaPackageElementFlavor getFlavor() {
102     return this.flavor;
103   }
104 
105   public void setFlavor(MediaPackageElementFlavor flavor) {
106     this.flavor = flavor;
107   }
108 
109   public URL getUrl() {
110     return url;
111   }
112 
113   public void setUrl(URL url) {
114     this.url = url;
115   }
116 }