-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
954 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
*.jar | ||
*.war | ||
*.ear | ||
/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "core"] | ||
path = core | ||
url = http://github.com/vwiencek/syncany.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
syncany-plugin-sftp | ||
=================== | ||
Syncany SFTP Plugin | ||
|
||
SFTP Syncany plugin | ||
#1 Steps to make it work | ||
|
||
git clone http://github.com/vwiencek/syncany-plugin-sftp.git | ||
cd syncany-plugin-hazelcast | ||
git submodule init | ||
git submodule update | ||
gradle eclipse | ||
|
||
Then you have a fully 'eclipse-prepared' environment to start improving the plugin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apply plugin: 'java' | ||
apply plugin: 'eclipse' | ||
|
||
dependencies { | ||
compile project(':syncany-lib') | ||
compile "com.jcraft:jsch:0.1.50" | ||
compile "org.apache.sshd:sshd-core:0.9.0" | ||
compile "org.apache.commons:commons-vfs2:2.0" | ||
|
||
testCompile "junit:junit:4.3" | ||
testCompile project(path : ':syncany-lib', configuration: 'tests') | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include 'syncany-lib' | ||
include 'syncany-util' | ||
|
||
project(':syncany-lib').projectDir = new File('core/syncany-lib') | ||
project(':syncany-util').projectDir = new File('core/syncany-util') |
114 changes: 114 additions & 0 deletions
114
src/main/java/org/syncany/connection/plugins/sftp/SftpConnection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* Syncany, www.syncany.org | ||
* Copyright (C) 2011-2014 Philipp C. Heckel <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.syncany.connection.plugins.sftp; | ||
|
||
import java.util.Map; | ||
|
||
import org.syncany.connection.plugins.Connection; | ||
import org.syncany.connection.plugins.PluginOptionSpec; | ||
import org.syncany.connection.plugins.PluginOptionSpec.ValueType; | ||
import org.syncany.connection.plugins.PluginOptionSpecs; | ||
import org.syncany.connection.plugins.StorageException; | ||
import org.syncany.connection.plugins.TransferManager; | ||
|
||
/** | ||
* The SFTP connection represents the settings required to connect to an | ||
* SFTP-based storage backend. It can be used to initialize/create an | ||
* {@link SftpTransferManager} and is part of the {@link SftpPlugin}. | ||
* | ||
* @author Vincent Wiencek <[email protected]> | ||
*/ | ||
public class SftpConnection implements Connection { | ||
private String hostname; | ||
private String username; | ||
private String password; | ||
private String path; | ||
private int port; | ||
|
||
@Override | ||
public TransferManager createTransferManager() { | ||
return new SftpTransferManager(this); | ||
} | ||
|
||
public String getHostname() { | ||
return hostname; | ||
} | ||
|
||
public void setHostname(String hostname) { | ||
this.hostname = hostname; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public void setPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public int getPort() { | ||
return port; | ||
} | ||
|
||
public void setPort(int port) { | ||
this.port = port; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
@Override | ||
public void init(Map<String, String> optionValues) throws StorageException { | ||
getOptionSpecs().validate(optionValues); | ||
this.hostname = optionValues.get("hostname"); | ||
this.username = optionValues.get("username"); | ||
this.password = optionValues.get("password"); | ||
this.path = optionValues.get("path"); | ||
this.port = Integer.parseInt(optionValues.get("port")); | ||
} | ||
|
||
@Override | ||
public PluginOptionSpecs getOptionSpecs() { | ||
return new PluginOptionSpecs( | ||
new PluginOptionSpec("hostname", "Hostname", ValueType.STRING, true, false, null), | ||
new PluginOptionSpec("username", "Username", ValueType.STRING, true, false, null), | ||
new PluginOptionSpec("password", "Password", ValueType.STRING, true, true, null), | ||
new PluginOptionSpec("path", "Path", ValueType.STRING, true, false, null), | ||
new PluginOptionSpec("port", "Port", ValueType.INT, false, false, "22") | ||
); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return SftpConnection.class.getSimpleName() | ||
+ "[hostname=" + hostname + ":" + port + ", username=" + username + ", path=" + path + "]"; | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/org/syncany/connection/plugins/sftp/SftpPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Syncany, www.syncany.org | ||
* Copyright (C) 2011-2014 Philipp C. Heckel <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.syncany.connection.plugins.sftp; | ||
|
||
import org.syncany.connection.plugins.Connection; | ||
import org.syncany.connection.plugins.Plugin; | ||
|
||
/** | ||
* Identifies the SFTP-based storage {@link Plugin} for Syncany. | ||
* | ||
* <p>This class defines the identifier, name and | ||
* version of the plugin. It furthermore allows the instantiation | ||
* of a plugin-specific {@link SftpConnection}. | ||
* | ||
* @author Vincent Wiencek <[email protected]> | ||
*/ | ||
public class SftpPlugin extends Plugin { | ||
public static final String ID = "sftp"; | ||
|
||
@Override | ||
public String getId() { | ||
return ID; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "SFTP"; | ||
} | ||
|
||
@Override | ||
public Integer[] getVersion() { | ||
return new Integer[] { 0, 1 }; | ||
} | ||
|
||
@Override | ||
public Connection createConnection() { | ||
return new SftpConnection(); | ||
} | ||
} |
Oops, something went wrong.