2 * ============LICENSE_START========================================================================
\r
3 * ONAP : tr-069-adapter
\r
4 * =================================================================================================
\r
5 * Copyright (C) 2020 CommScope Inc Intellectual Property.
\r
6 * =================================================================================================
\r
7 * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
\r
8 * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
\r
9 * may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
\r
14 * either express or implied. See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
16 * ===============LICENSE_END=======================================================================
\r
19 package org.commscope.tr069adapter.acs.cpe.rpc;
\r
21 import javax.xml.soap.SOAPBodyElement;
\r
22 import javax.xml.soap.SOAPException;
\r
23 import javax.xml.soap.SOAPFactory;
\r
25 import org.commscope.tr069adapter.acs.cpe.TR069RPC;
\r
27 public class Download extends TR069RPC {
\r
29 private static final long serialVersionUID = 8989750644171761861L;
\r
31 /** Creates a new instance of Download */
\r
36 public Download(String commandKey, String url, String fileType) {
\r
38 this.commandKey = commandKey;
\r
40 this.fileType = fileType;
\r
43 protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {
\r
44 body.addChildElement(COMMAND_KEY).setValue(commandKey);
\r
45 body.addChildElement("FileType").setValue(fileType);
\r
46 body.addChildElement("URL").setValue(url);
\r
47 body.addChildElement("Username").setValue(userName);
\r
48 body.addChildElement("Password").setValue(password);
\r
49 body.addChildElement("FileSize").setValue(String.valueOf(fileSize));
\r
50 body.addChildElement("TargetFileName").setValue(targetFileName);
\r
51 body.addChildElement("DelaySeconds").setValue(String.valueOf(delaySeconds));
\r
52 body.addChildElement("SuccessURL").setValue(successUrl);
\r
53 body.addChildElement("FailureURL").setValue(failureUrl);
\r
56 protected void parseBody(SOAPBodyElement body, SOAPFactory f) throws SOAPException {
\r
57 body.getAllAttributes();
\r
60 private String commandKey = "";
\r
61 private String fileType = "";
\r
62 private String url = "";
\r
63 private String userName = "";
\r
64 private String password = "";
\r
65 private long fileSize = 0;
\r
66 private String targetFileName = "";
\r
67 private int delaySeconds = 0;
\r
68 private String successUrl = "";
\r
69 private String failureUrl = "";
\r
70 public static final String FT_FIRMWARE = "1 Firmware Upgrade Image";
\r
71 public static final String FT_WEBCONTENT = "2 Web Content";
\r
72 public static final String FT_CONFIG = "3 Vendor Configuration File";
\r
74 public String getCommandKey() {
\r
78 public void setCommandKey(String commandKey) {
\r
79 this.commandKey = commandKey;
\r
82 public String getFileType() {
\r
86 public void setFileType(String fileType) {
\r
87 this.fileType = fileType;
\r
90 public String getUrl() {
\r
94 public void setUrl(String url) {
\r
98 public String getUserName() {
\r
102 public void setUserName(String userName) {
\r
103 this.userName = userName;
\r
106 public String getPassword() {
\r
110 public void setPassword(String password) {
\r
111 this.password = password;
\r
114 public long getFileSize() {
\r
118 public void setFileSize(long fileSize) {
\r
119 this.fileSize = fileSize;
\r
122 public String getTargetFileName() {
\r
123 return targetFileName;
\r
126 public void setTargetFileName(String targetFileName) {
\r
127 this.targetFileName = targetFileName;
\r
130 public int getDelaySeconds() {
\r
131 return delaySeconds;
\r
134 public void setDelaySeconds(int delaySeconds) {
\r
135 this.delaySeconds = delaySeconds;
\r
138 public String getSuccessUrl() {
\r
142 public void setSuccessUrl(String successUrl) {
\r
143 this.successUrl = successUrl;
\r
146 public String getFailureUrl() {
\r
150 public void setFailureUrl(String failureUrl) {
\r
151 this.failureUrl = failureUrl;
\r