Refactored FTP Upload and Download behaviours.
Made FTP behaviours to use Passive mode instead of active. [artf448994]
4
.idea/libraries/support_v4_19_1_0.xml
generated
|
|
@ -1,11 +1,11 @@
|
|||
<component name="libraryTable">
|
||||
<library name="support-v4-19.1.0">
|
||||
<CLASSES>
|
||||
<root url="jar://C:/Program Files (x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0.jar!/" />
|
||||
<root url="jar://C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://C:/Program Files (x86)/Android/sdk/extras/android/m2repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0-sources.jar!/" />
|
||||
<root url="jar://C:/Program Files (x86)/Android/android-sdk/extras/android/m2repository/com/android/support/support-v4/19.1.0/support-v4-19.1.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
3
.idea/misc.xml
generated
|
|
@ -3,8 +3,7 @@
|
|||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
|
|
|||
124
.idea/uiDesigner.xml
generated
Executable file
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id="UeControl" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
|
|
@ -12,8 +12,7 @@
|
|||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="JDK" jdkType="JavaSDK" />
|
||||
<orderEntry type="jdk" jdkName="1.7" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
|||
13
app/app.iml
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="UeControl" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="UeControl" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
|
|
@ -80,14 +80,13 @@
|
|||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 15 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="dom4j-1.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="GraphView-3.1.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-logging-log4j-1.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-v4-19.1.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="jaxen-1.1.6" level="project" />
|
||||
<orderEntry type="library" exported="" name="dom4j-1.6.1" level="project" />
|
||||
<orderEntry type="library" exported="" name="log4j-1.2.17" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-net-3.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-logging-log4j-1.0.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="commons-net-3.3" level="project" />
|
||||
<orderEntry type="library" exported="" name="jaxen-1.1.6" level="project" />
|
||||
<orderEntry type="library" exported="" name="GraphView-3.1.3" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
|
|
|||
0
app/draggable.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
0
app/file.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
0
app/folder.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
0
app/function.png
Normal file → Executable file
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
0
app/function.svg
Normal file → Executable file
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
0
app/libs/android-logging-log4j-1.0.3.jar
Normal file → Executable file
0
app/libs/dom4j-1.6.1.jar
Normal file → Executable file
0
app/libs/gson-2.3.jar
Normal file → Executable file
0
app/libs/jaxen-1.1.6.jar
Normal file → Executable file
0
app/libs/log4j-1.2.17.jar
Normal file → Executable file
0
app/libs/src/GraphView-3.1.3.zip
Normal file → Executable file
68
app/src/main/java/com/ericsson/uecontrol/core/behaviour/UeBehaviourFtp.java
Executable file
|
|
@ -0,0 +1,68 @@
|
|||
package com.ericsson.uecontrol.core.behaviour;
|
||||
|
||||
import com.ericsson.uecontrol.core.UeBehaviour;
|
||||
import org.apache.commons.net.ftp.FTP;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This behaviour simulates downloading a file from FTP
|
||||
*
|
||||
* Created by ezivkoc on 2014-07-15.
|
||||
*/
|
||||
public abstract class UeBehaviourFtp extends UeBehaviour {
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourFtp.class);
|
||||
|
||||
final protected void execute() throws IOException {
|
||||
FTPClient ftp = new FTPClient();
|
||||
try {
|
||||
// Connect
|
||||
ftp.setConnectTimeout(5000);
|
||||
ftp.setDataTimeout(3000);
|
||||
if (getHost().contains(":")) {
|
||||
String tmpHost = getHost().substring(0, getHost().indexOf(':'));
|
||||
int tmpPort = Integer.parseInt(getHost().substring(getHost().indexOf(':')));
|
||||
ftp.connect(tmpHost, tmpPort);
|
||||
} else ftp.connect(getHost());
|
||||
if(getUsername() != null && !getUsername().isEmpty())
|
||||
ftp.login(getUsername(), getPassword());
|
||||
ftp.setFileType(FTP.BINARY_FILE_TYPE);
|
||||
ftp.enterLocalPassiveMode();
|
||||
|
||||
executeFtp(ftp);
|
||||
|
||||
// Disconnect
|
||||
ftp.logout();
|
||||
} finally {
|
||||
if(ftp.isConnected()) {
|
||||
ftp.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String getFtpUrl(String filePath) {
|
||||
String url = "ftp://";
|
||||
if(getUsername() != null && !getUsername().isEmpty()) {
|
||||
url += getUsername();
|
||||
if(getPassword() !=null && !getPassword().isEmpty())
|
||||
url += ":" + getPassword();
|
||||
url += "@";
|
||||
}
|
||||
url += getHost();
|
||||
if(filePath != null && !filePath.isEmpty()){
|
||||
if(!filePath.startsWith("/"))
|
||||
filePath = "/"+filePath;
|
||||
url += filePath;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
abstract protected void executeFtp(FTPClient client) throws IOException;
|
||||
|
||||
abstract String getHost();
|
||||
abstract String getUsername();
|
||||
abstract String getPassword();
|
||||
}
|
||||
|
|
@ -2,15 +2,19 @@ package com.ericsson.uecontrol.core.behaviour;
|
|||
|
||||
import com.ericsson.uecontrol.gui.util.Configurator.Configurable;
|
||||
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* This behaviour simulates downloading a file from FTP
|
||||
*
|
||||
* Created by ezivkoc on 2014-07-15.
|
||||
*/
|
||||
public class UeBehaviourFtpDownload extends UeBehaviourFileDownload {
|
||||
public class UeBehaviourFtpDownload extends UeBehaviourFtp {
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourFtpDownload.class);
|
||||
private static final int BUFFER_SIZE = 512;
|
||||
|
||||
@Configurable("Host")
|
||||
private String host = "ftp.otenet.gr";
|
||||
|
|
@ -21,23 +25,46 @@ public class UeBehaviourFtpDownload extends UeBehaviourFileDownload {
|
|||
@Configurable("Password")
|
||||
private String password = "speedtest";
|
||||
|
||||
private transient long estimatedDataLength = -1;
|
||||
|
||||
@Override
|
||||
protected String getFileUrl() {
|
||||
String url = "ftp://";
|
||||
if(username != null && !username.isEmpty()) {
|
||||
url += username;
|
||||
if(password !=null && !password.isEmpty())
|
||||
url += ":"+password;
|
||||
url += "@";
|
||||
protected void executeFtp(FTPClient ftp) throws IOException {
|
||||
// Download data
|
||||
InputStream inStream = ftp.retrieveFileStream(filePath);
|
||||
if (inStream != null) {
|
||||
InputStream in = new BufferedInputStream(inStream);
|
||||
|
||||
long progress = 0;
|
||||
long read = 0;
|
||||
byte[] data = new byte[BUFFER_SIZE];
|
||||
|
||||
while((read = in.read(data)) != -1 && !stopExecution()){
|
||||
progress += read;
|
||||
super.setProgress((float)progress/estimatedDataLength);
|
||||
}
|
||||
url += host;
|
||||
if(filePath != null && !filePath.isEmpty()){
|
||||
if(!filePath.startsWith("/"))
|
||||
filePath = "/"+filePath;
|
||||
url += filePath;
|
||||
|
||||
estimatedDataLength = progress;
|
||||
in.close();
|
||||
if(!ftp.completePendingCommand()) {
|
||||
throw new IOException("FTP reply: "+ftp.getReplyString());
|
||||
}
|
||||
return url;
|
||||
} else {
|
||||
throw new IOException("FTP reply: "+ftp.getReplyString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -46,4 +73,8 @@ public class UeBehaviourFtpDownload extends UeBehaviourFileDownload {
|
|||
return "FTP Download";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Will download " + getFtpUrl(filePath);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.net.URLConnection;
|
|||
*
|
||||
* Created by ezivkoc on 2014-07-15.
|
||||
*/
|
||||
public class UeBehaviourFtpUpload extends UeBehaviour {
|
||||
public class UeBehaviourFtpUpload extends UeBehaviourFtp {
|
||||
private static final int BUFFER_SIZE = 512;
|
||||
private static final Logger log = Logger.getLogger(UeBehaviourFtpUpload.class);
|
||||
|
||||
|
|
@ -38,20 +38,7 @@ public class UeBehaviourFtpUpload extends UeBehaviour {
|
|||
|
||||
|
||||
@Override
|
||||
protected void execute() throws IOException {
|
||||
FTPClient ftp = new FTPClient();
|
||||
try {
|
||||
// Connect
|
||||
ftp.setConnectTimeout(3000);
|
||||
ftp.setDataTimeout(200);
|
||||
if (host.contains(":")) {
|
||||
String tmpHost = host.substring(0, host.indexOf(':'));
|
||||
int tmpPort = Integer.parseInt(host.substring(host.indexOf(':')));
|
||||
ftp.connect(tmpHost, tmpPort);
|
||||
} else ftp.connect(host);
|
||||
ftp.login(username, password);
|
||||
ftp.setFileType(FTP.BINARY_FILE_TYPE);
|
||||
|
||||
protected void executeFtp(FTPClient ftp) throws IOException {
|
||||
// Upload data
|
||||
OutputStream outStream = ftp.storeFileStream(filePath);
|
||||
if (outStream != null) {
|
||||
|
|
@ -72,51 +59,21 @@ public class UeBehaviourFtpUpload extends UeBehaviour {
|
|||
} else {
|
||||
throw new IOException("FTP reply: "+ftp.getReplyString());
|
||||
}
|
||||
|
||||
// Disconnect
|
||||
ftp.logout();
|
||||
} finally {
|
||||
if(ftp.isConnected()) {
|
||||
ftp.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* @Override
|
||||
protected void execute() throws IOException {
|
||||
URL url = new URL(getFileUrl());
|
||||
log.debug("Uploading file: " + url);
|
||||
|
||||
byte[] data = new byte[BUFFER_SIZE];
|
||||
URLConnection connection = url.openConnection();
|
||||
OutputStream out = new BufferedOutputStream(connection.getOutputStream());
|
||||
|
||||
int total = 0;
|
||||
while(total < size && !stopExecution()){
|
||||
int writeLength = (total+data.length < size ? data.length : total+data.length-size);
|
||||
out.write(data, 0, writeLength);
|
||||
|
||||
total += writeLength;
|
||||
super.setProgress((float)total/size);
|
||||
@Override
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
out.close();
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
*/
|
||||
protected String getFileUrl() {
|
||||
String url = "ftp://";
|
||||
if(username != null && !username.isEmpty()) {
|
||||
url += username;
|
||||
if(password !=null && !password.isEmpty())
|
||||
url += ":"+password;
|
||||
url += "@";
|
||||
}
|
||||
url += host;
|
||||
if(filePath != null && !filePath.isEmpty()){
|
||||
if(!filePath.startsWith("/"))
|
||||
filePath = "/"+filePath;
|
||||
url += filePath;
|
||||
}
|
||||
return url;
|
||||
@Override
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,12 @@ import android.content.Context;
|
|||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
import android.os.Handler;
|
||||
import com.ericsson.uecontrol.gui.MainActivity;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
|
||||
|
|
@ -14,15 +17,24 @@ import java.net.URLConnection;
|
|||
* Created by ezivkoc on 2014-09-18.
|
||||
*/
|
||||
public class UrlUtil {
|
||||
private static final Logger log = Logger.getLogger(UrlUtil.class);
|
||||
|
||||
public static URLConnection getURLConnection(URL url) throws IOException {
|
||||
if(!isNetworkAvailable())
|
||||
throw new IOException("No Data Network Available");
|
||||
|
||||
URLConnection connection = url.openConnection();
|
||||
final URLConnection connection = url.openConnection();
|
||||
connection.setConnectTimeout(5000);
|
||||
connection.setReadTimeout(3000);
|
||||
connection.setUseCaches(false);
|
||||
|
||||
/*new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try{Thread.sleep(5000);}catch(Exception e){};
|
||||
log.error("Force disconnect URLConnection");
|
||||
connection.
|
||||
}
|
||||
}).start();*/
|
||||
connection.connect();
|
||||
|
||||
return connection;
|
||||
|
|
|
|||
47
app/src/main/java/com/ericsson/uecontrol/gui/util/WifiScanner.java
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
package com.ericsson.uecontrol.gui.util;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.WifiManager;
|
||||
|
||||
import com.ericsson.uecontrol.gui.MainActivity;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ezivkoc on 2014-11-05.
|
||||
*/
|
||||
public class WifiScanner {
|
||||
private static final Logger log = Logger.getLogger(WifiScanner.class);
|
||||
|
||||
private WifiManager mainWifi;
|
||||
private WifiReceiver receiverWifi;
|
||||
|
||||
public WifiScanner() {
|
||||
mainWifi = (WifiManager) MainActivity.getContext().getSystemService(MainActivity.getContext().WIFI_SERVICE);
|
||||
receiverWifi = new WifiReceiver();
|
||||
}
|
||||
|
||||
protected void start() {
|
||||
MainActivity.getContext().registerReceiver(receiverWifi, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
|
||||
mainWifi.startScan();
|
||||
}
|
||||
|
||||
protected void stop() {
|
||||
MainActivity.getContext().unregisterReceiver(receiverWifi);
|
||||
}
|
||||
|
||||
|
||||
class WifiReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context c, Intent intent) {
|
||||
List<ScanResult> scanList = mainWifi.getScanResults();
|
||||
for(ScanResult item : scanList){
|
||||
log.debug("WiFi scan found SSID: "+item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
0
app/src/main/res/drawable-hdpi/arrow_down_24.png
Normal file → Executable file
|
Before Width: | Height: | Size: 692 B After Width: | Height: | Size: 692 B |
0
app/src/main/res/drawable-hdpi/arrow_up_24.png
Normal file → Executable file
|
Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 714 B |
0
app/src/main/res/drawable-hdpi/file.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
0
app/src/main/res/drawable-hdpi/folder.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
0
app/src/main/res/drawable-hdpi/stat_download.xml
Normal file → Executable file
0
app/src/main/res/drawable-hdpi/stat_download_static.xml
Normal file → Executable file
0
app/src/main/res/drawable-hdpi/stat_sys_download_anim0.png
Normal file → Executable file
|
Before Width: | Height: | Size: 695 B After Width: | Height: | Size: 695 B |
0
app/src/main/res/drawable-hdpi/stat_sys_download_anim1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 675 B |
0
app/src/main/res/drawable-hdpi/stat_sys_download_anim2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 697 B |
0
app/src/main/res/drawable-hdpi/stat_sys_download_anim3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 688 B |
0
app/src/main/res/drawable-hdpi/stat_sys_download_anim4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 660 B |
0
app/src/main/res/drawable-hdpi/stat_sys_download_anim5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 673 B After Width: | Height: | Size: 673 B |
0
app/src/main/res/drawable-hdpi/stat_sys_upload_anim0.png
Normal file → Executable file
|
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 690 B |
0
app/src/main/res/drawable-hdpi/stat_sys_upload_anim1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 681 B After Width: | Height: | Size: 681 B |
0
app/src/main/res/drawable-hdpi/stat_sys_upload_anim2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 634 B After Width: | Height: | Size: 634 B |
0
app/src/main/res/drawable-hdpi/stat_sys_upload_anim3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
0
app/src/main/res/drawable-hdpi/stat_sys_upload_anim4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 697 B |
0
app/src/main/res/drawable-hdpi/stat_sys_upload_anim5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 669 B After Width: | Height: | Size: 669 B |
0
app/src/main/res/drawable-hdpi/stat_upload.xml
Normal file → Executable file
0
app/src/main/res/drawable-mdpi/draggable.png
Normal file → Executable file
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 569 B |
0
app/src/main/res/drawable-mdpi/file.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
app/src/main/res/drawable-mdpi/folder.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
app/src/main/res/drawable-mdpi/icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
app/src/main/res/drawable-mdpi/stat_sys_download_anim0.png
Normal file → Executable file
|
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
0
app/src/main/res/drawable-mdpi/stat_sys_download_anim1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 571 B |
0
app/src/main/res/drawable-mdpi/stat_sys_download_anim2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 576 B |
0
app/src/main/res/drawable-mdpi/stat_sys_download_anim3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
0
app/src/main/res/drawable-mdpi/stat_sys_download_anim4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 557 B |
0
app/src/main/res/drawable-mdpi/stat_sys_download_anim5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 567 B After Width: | Height: | Size: 567 B |
0
app/src/main/res/drawable-mdpi/stat_sys_upload_anim0.png
Normal file → Executable file
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 580 B |
0
app/src/main/res/drawable-mdpi/stat_sys_upload_anim1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 577 B |
0
app/src/main/res/drawable-mdpi/stat_sys_upload_anim2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 545 B After Width: | Height: | Size: 545 B |
0
app/src/main/res/drawable-mdpi/stat_sys_upload_anim3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 586 B |
0
app/src/main/res/drawable-mdpi/stat_sys_upload_anim4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 582 B After Width: | Height: | Size: 582 B |
0
app/src/main/res/drawable-mdpi/stat_sys_upload_anim5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 573 B After Width: | Height: | Size: 573 B |
0
app/src/main/res/drawable-xhdpi/draggable.png
Normal file → Executable file
|
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 933 B |
0
app/src/main/res/drawable-xhdpi/file.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
app/src/main/res/drawable-xhdpi/folder.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
0
app/src/main/res/drawable-xhdpi/icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
0
app/src/main/res/drawable-xhdpi/stat_sys_download_anim0.png
Normal file → Executable file
|
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 798 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_download_anim1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 811 B After Width: | Height: | Size: 811 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_download_anim2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 819 B After Width: | Height: | Size: 819 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_download_anim3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 821 B After Width: | Height: | Size: 821 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_download_anim4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 783 B After Width: | Height: | Size: 783 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_download_anim5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 785 B After Width: | Height: | Size: 785 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_upload_anim0.png
Normal file → Executable file
|
Before Width: | Height: | Size: 813 B After Width: | Height: | Size: 813 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_upload_anim1.png
Normal file → Executable file
|
Before Width: | Height: | Size: 814 B After Width: | Height: | Size: 814 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_upload_anim2.png
Normal file → Executable file
|
Before Width: | Height: | Size: 759 B After Width: | Height: | Size: 759 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_upload_anim3.png
Normal file → Executable file
|
Before Width: | Height: | Size: 848 B After Width: | Height: | Size: 848 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_upload_anim4.png
Normal file → Executable file
|
Before Width: | Height: | Size: 837 B After Width: | Height: | Size: 837 B |
0
app/src/main/res/drawable-xhdpi/stat_sys_upload_anim5.png
Normal file → Executable file
|
Before Width: | Height: | Size: 794 B After Width: | Height: | Size: 794 B |
0
app/src/main/res/drawable-xxhdpi/draggable.png
Normal file → Executable file
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
app/src/main/res/drawable-xxhdpi/file.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
0
app/src/main/res/drawable-xxhdpi/folder.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4 KiB |
0
app/src/main/res/drawable-xxhdpi/icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
0
app/src/main/resources/META-INF/licenses/GraphView/license.txt
Normal file → Executable file
0
app/src/main/resources/META-INF/licenses/android-logging-log4j/LICENSE
Normal file → Executable file
0
app/src/main/resources/META-INF/licenses/dom4j/LICENSE.txt
Normal file → Executable file
0
app/src/main/resources/META-INF/licenses/gson/LICENSE
Normal file → Executable file
0
app/src/main/resources/META-INF/licenses/jaxen/LICENSE.txt
Normal file → Executable file
0
app/src/main/resources/META-INF/licenses/log4j/LICENSE
Normal file → Executable file
0
app/src/main/resources/META-INF/licenses/log4j/NOTICE
Normal file → Executable file
0
app_icon.png
Normal file → Executable file
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |