Initial source code
[oam/tr069-adapter.git] / acs / cpe / src / main / java / org / commscope / tr069adapter / acs / cpe / rpc / Download.java
1 /*\r
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
10  *\r
11  * http://www.apache.org/licenses/LICENSE-2.0\r
12  *\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
17  */\r
18 \r
19 package org.commscope.tr069adapter.acs.cpe.rpc;\r
20 \r
21 import javax.xml.soap.SOAPBodyElement;\r
22 import javax.xml.soap.SOAPException;\r
23 import javax.xml.soap.SOAPFactory;\r
24 \r
25 import org.commscope.tr069adapter.acs.cpe.TR069RPC;\r
26 \r
27 public class Download extends TR069RPC {\r
28 \r
29   private static final long serialVersionUID = 8989750644171761861L;\r
30 \r
31   /** Creates a new instance of Download */\r
32   public Download() {\r
33     name = "Download";\r
34   }\r
35 \r
36   public Download(String commandKey, String url, String fileType) {\r
37     name = "Download";\r
38     this.commandKey = commandKey;\r
39     this.url = url;\r
40     this.fileType = fileType;\r
41   }\r
42 \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
54   }\r
55 \r
56   protected void parseBody(SOAPBodyElement body, SOAPFactory f) throws SOAPException {\r
57     body.getAllAttributes();\r
58   }\r
59 \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
73 \r
74   public String getCommandKey() {\r
75     return commandKey;\r
76   }\r
77 \r
78   public void setCommandKey(String commandKey) {\r
79     this.commandKey = commandKey;\r
80   }\r
81 \r
82   public String getFileType() {\r
83     return fileType;\r
84   }\r
85 \r
86   public void setFileType(String fileType) {\r
87     this.fileType = fileType;\r
88   }\r
89 \r
90   public String getUrl() {\r
91     return url;\r
92   }\r
93 \r
94   public void setUrl(String url) {\r
95     this.url = url;\r
96   }\r
97 \r
98   public String getUserName() {\r
99     return userName;\r
100   }\r
101 \r
102   public void setUserName(String userName) {\r
103     this.userName = userName;\r
104   }\r
105 \r
106   public String getPassword() {\r
107     return password;\r
108   }\r
109 \r
110   public void setPassword(String password) {\r
111     this.password = password;\r
112   }\r
113 \r
114   public long getFileSize() {\r
115     return fileSize;\r
116   }\r
117 \r
118   public void setFileSize(long fileSize) {\r
119     this.fileSize = fileSize;\r
120   }\r
121 \r
122   public String getTargetFileName() {\r
123     return targetFileName;\r
124   }\r
125 \r
126   public void setTargetFileName(String targetFileName) {\r
127     this.targetFileName = targetFileName;\r
128   }\r
129 \r
130   public int getDelaySeconds() {\r
131     return delaySeconds;\r
132   }\r
133 \r
134   public void setDelaySeconds(int delaySeconds) {\r
135     this.delaySeconds = delaySeconds;\r
136   }\r
137 \r
138   public String getSuccessUrl() {\r
139     return successUrl;\r
140   }\r
141 \r
142   public void setSuccessUrl(String successUrl) {\r
143     this.successUrl = successUrl;\r
144   }\r
145 \r
146   public String getFailureUrl() {\r
147     return failureUrl;\r
148   }\r
149 \r
150   public void setFailureUrl(String failureUrl) {\r
151     this.failureUrl = failureUrl;\r
152   }\r
153 }\r