Skip to content

Replace sshj with mina ssh #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,6 @@
<artifactId>curator-recipes</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>0.38.0</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -305,7 +300,6 @@
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-sftp</artifactId>
<version>2.12.1</version>
<scope>test</scope>
</dependency>
</dependencies>

Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/mortbay/jetty/orchestrator/Cluster.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,24 @@ private void init() throws Exception
throw new IllegalStateException("No configured host launcher to start node on " + hostname);
futures.add(executor.submit(() ->
{
if (LOG.isDebugEnabled())
LOG.debug("launching {}", globalNodeId);
String remoteConnectString = launcher.launch(globalNodeId, connectString);
if (LOG.isDebugEnabled())
LOG.debug("launched {}", globalNodeId);
return new AbstractMap.SimpleImmutableEntry<>(globalNodeId, remoteConnectString);
}));
}
executor.shutdown();
for (Future<Map.Entry<GlobalNodeId, String>> future : futures)
{
Map.Entry<GlobalNodeId, String> entry = future.get();
Map.Entry<GlobalNodeId, String> entry = future.get(120, TimeUnit.SECONDS);
GlobalNodeId globalNodeId = entry.getKey();
String remoteConnectString = entry.getValue();
hosts.put(globalNodeId, new Host(globalNodeId, new RpcClient(curator, globalNodeId), remoteConnectString));
}
if (LOG.isDebugEnabled())
LOG.debug("All hosts nodes connected to cluster, spawning node arrays...");

// start all worker nodes
for (NodeArrayConfiguration nodeArrayConfig : configuration.nodeArrays())
Expand Down Expand Up @@ -164,6 +170,9 @@ public void run()
}
}
}, RpcClient.HEALTH_CHECK_DELAY_MS, RpcClient.HEALTH_CHECK_DELAY_MS);

if (LOG.isDebugEnabled())
LOG.info("Cluster initialized, requested host nodes to spawn their node arrays: {}", hosts.values());
}

public ClusterTools tools()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Path rootPathOf(String id)
}
else
{
URI uri = URI.create(NodeFileSystemProvider.PREFIX + ":" + node.globalNodeId.getHostId() + "!/." + NodeFileSystemProvider.PREFIX + "/" + node.globalNodeId.getNodeId());
URI uri = URI.create(NodeFileSystemProvider.SCHEME + ":" + node.globalNodeId.getHostId() + "!/." + NodeFileSystemProvider.SCHEME + "/" + node.globalNodeId.getNodeId());
return Paths.get(uri);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void close() throws Exception

public static File rootPathOf(String hostId)
{
return new File(System.getProperty("user.home") + "/." + NodeFileSystemProvider.PREFIX + "/" + hostId);
return new File(System.getProperty("user.home") + "/." + NodeFileSystemProvider.SCHEME + "/" + hostId);
}

private static void copyFile(String hostId, String filename, InputStream contents) throws Exception
Expand Down

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,78 +13,71 @@

package org.mortbay.jetty.orchestrator.nodefs;

import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.util.concurrent.TimeUnit;

import net.schmizz.sshj.sftp.FileAttributes;
import net.schmizz.sshj.sftp.FileMode;

class NodeFileAttributes implements BasicFileAttributes
class NodeFileAttributes // implements BasicFileAttributes
{
private final FileAttributes lstat;

NodeFileAttributes(FileAttributes lstat)
{
this.lstat = lstat;
}

public FileAttributes getLstat()
{
return lstat;
}

@Override
public FileTime lastModifiedTime()
{
return FileTime.from(lstat.getMtime(), TimeUnit.MILLISECONDS);
}

@Override
public FileTime lastAccessTime()
{
return FileTime.from(lstat.getAtime(), TimeUnit.MILLISECONDS);
}

@Override
public FileTime creationTime()
{
return lastModifiedTime();
}

@Override
public boolean isRegularFile()
{
return lstat.getType() == FileMode.Type.REGULAR;
}

@Override
public boolean isDirectory()
{
return lstat.getType() == FileMode.Type.DIRECTORY;
}

@Override
public boolean isSymbolicLink()
{
return lstat.getType() == FileMode.Type.SYMLINK;
}

@Override
public boolean isOther()
{
return !isDirectory() && !isRegularFile() && !isSymbolicLink();
}

@Override
public long size()
{
return lstat.getSize();
}

@Override
public Object fileKey()
{
return null;
}
// private final FileAttributes lstat;
//
// NodeFileAttributes(FileAttributes lstat)
// {
// this.lstat = lstat;
// }
//
// public FileAttributes getLstat()
// {
// return lstat;
// }
//
// @Override
// public FileTime lastModifiedTime()
// {
// return FileTime.from(lstat.getMtime(), TimeUnit.MILLISECONDS);
// }
//
// @Override
// public FileTime lastAccessTime()
// {
// return FileTime.from(lstat.getAtime(), TimeUnit.MILLISECONDS);
// }
//
// @Override
// public FileTime creationTime()
// {
// return lastModifiedTime();
// }
//
// @Override
// public boolean isRegularFile()
// {
// return lstat.getType() == FileMode.Type.REGULAR;
// }
//
// @Override
// public boolean isDirectory()
// {
// return lstat.getType() == FileMode.Type.DIRECTORY;
// }
//
// @Override
// public boolean isSymbolicLink()
// {
// return lstat.getType() == FileMode.Type.SYMLINK;
// }
//
// @Override
// public boolean isOther()
// {
// return !isDirectory() && !isRegularFile() && !isSymbolicLink();
// }
//
// @Override
// public long size()
// {
// return lstat.getSize();
// }
//
// @Override
// public Object fileKey()
// {
// return null;
// }
}
Loading
Loading