Initial source code
[oam/tr069-adapter.git] / acs / cpe / src / main / java / org / commscope / tr069adapter / acs / cpe / rpc / Download.java
diff --git a/acs/cpe/src/main/java/org/commscope/tr069adapter/acs/cpe/rpc/Download.java b/acs/cpe/src/main/java/org/commscope/tr069adapter/acs/cpe/rpc/Download.java
new file mode 100644 (file)
index 0000000..a67aa2e
--- /dev/null
@@ -0,0 +1,153 @@
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.acs.cpe.rpc;\r
+\r
+import javax.xml.soap.SOAPBodyElement;\r
+import javax.xml.soap.SOAPException;\r
+import javax.xml.soap.SOAPFactory;\r
+\r
+import org.commscope.tr069adapter.acs.cpe.TR069RPC;\r
+\r
+public class Download extends TR069RPC {\r
+\r
+  private static final long serialVersionUID = 8989750644171761861L;\r
+\r
+  /** Creates a new instance of Download */\r
+  public Download() {\r
+    name = "Download";\r
+  }\r
+\r
+  public Download(String commandKey, String url, String fileType) {\r
+    name = "Download";\r
+    this.commandKey = commandKey;\r
+    this.url = url;\r
+    this.fileType = fileType;\r
+  }\r
+\r
+  protected void createBody(SOAPBodyElement body, SOAPFactory spf) throws SOAPException {\r
+    body.addChildElement(COMMAND_KEY).setValue(commandKey);\r
+    body.addChildElement("FileType").setValue(fileType);\r
+    body.addChildElement("URL").setValue(url);\r
+    body.addChildElement("Username").setValue(userName);\r
+    body.addChildElement("Password").setValue(password);\r
+    body.addChildElement("FileSize").setValue(String.valueOf(fileSize));\r
+    body.addChildElement("TargetFileName").setValue(targetFileName);\r
+    body.addChildElement("DelaySeconds").setValue(String.valueOf(delaySeconds));\r
+    body.addChildElement("SuccessURL").setValue(successUrl);\r
+    body.addChildElement("FailureURL").setValue(failureUrl);\r
+  }\r
+\r
+  protected void parseBody(SOAPBodyElement body, SOAPFactory f) throws SOAPException {\r
+    body.getAllAttributes();\r
+  }\r
+\r
+  private String commandKey = "";\r
+  private String fileType = "";\r
+  private String url = "";\r
+  private String userName = "";\r
+  private String password = "";\r
+  private long fileSize = 0;\r
+  private String targetFileName = "";\r
+  private int delaySeconds = 0;\r
+  private String successUrl = "";\r
+  private String failureUrl = "";\r
+  public static final String FT_FIRMWARE = "1 Firmware Upgrade Image";\r
+  public static final String FT_WEBCONTENT = "2 Web Content";\r
+  public static final String FT_CONFIG = "3 Vendor Configuration File";\r
+\r
+  public String getCommandKey() {\r
+    return commandKey;\r
+  }\r
+\r
+  public void setCommandKey(String commandKey) {\r
+    this.commandKey = commandKey;\r
+  }\r
+\r
+  public String getFileType() {\r
+    return fileType;\r
+  }\r
+\r
+  public void setFileType(String fileType) {\r
+    this.fileType = fileType;\r
+  }\r
+\r
+  public String getUrl() {\r
+    return url;\r
+  }\r
+\r
+  public void setUrl(String url) {\r
+    this.url = url;\r
+  }\r
+\r
+  public String getUserName() {\r
+    return userName;\r
+  }\r
+\r
+  public void setUserName(String userName) {\r
+    this.userName = userName;\r
+  }\r
+\r
+  public String getPassword() {\r
+    return password;\r
+  }\r
+\r
+  public void setPassword(String password) {\r
+    this.password = password;\r
+  }\r
+\r
+  public long getFileSize() {\r
+    return fileSize;\r
+  }\r
+\r
+  public void setFileSize(long fileSize) {\r
+    this.fileSize = fileSize;\r
+  }\r
+\r
+  public String getTargetFileName() {\r
+    return targetFileName;\r
+  }\r
+\r
+  public void setTargetFileName(String targetFileName) {\r
+    this.targetFileName = targetFileName;\r
+  }\r
+\r
+  public int getDelaySeconds() {\r
+    return delaySeconds;\r
+  }\r
+\r
+  public void setDelaySeconds(int delaySeconds) {\r
+    this.delaySeconds = delaySeconds;\r
+  }\r
+\r
+  public String getSuccessUrl() {\r
+    return successUrl;\r
+  }\r
+\r
+  public void setSuccessUrl(String successUrl) {\r
+    this.successUrl = successUrl;\r
+  }\r
+\r
+  public String getFailureUrl() {\r
+    return failureUrl;\r
+  }\r
+\r
+  public void setFailureUrl(String failureUrl) {\r
+    this.failureUrl = failureUrl;\r
+  }\r
+}\r