hzzz
7 years ago
1 changed files with 28 additions and 17 deletions
@ -1,62 +1,73 @@
|
||||
package com.fr.design.env; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.report.util.RemoteDesignAuthenticateUtils; |
||||
import com.fr.workspace.Workspace; |
||||
import com.fr.workspace.connect.WorkspaceClient; |
||||
import com.fr.workspace.connect.WorkspaceConnection; |
||||
import com.fr.workspace.engine.WorkspaceServerContext; |
||||
|
||||
/** |
||||
* Created by juhaoyu on 2018/6/14. |
||||
* 远程工作目录 |
||||
*/ |
||||
public class RemoteWorkspace implements Workspace { |
||||
|
||||
|
||||
private final WorkspaceClient client; |
||||
|
||||
|
||||
private final String address; |
||||
|
||||
|
||||
private final String userName; |
||||
|
||||
|
||||
RemoteWorkspace(WorkspaceClient client, WorkspaceConnection connection) { |
||||
|
||||
|
||||
this.client = client; |
||||
this.address = connection.getIp() + ":" + connection.getPort(); |
||||
this.userName = connection.getUserName(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String getName() { |
||||
|
||||
|
||||
return userName; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String getPath() { |
||||
|
||||
|
||||
return address; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public String getDescription() { |
||||
|
||||
|
||||
return userName + "@" + "[" + Inter.getLocText("Fine-Designer_Basic_Remote_Env") + "]"; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public boolean isWarDeploy() { |
||||
|
||||
|
||||
return false; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public boolean isLocal() { |
||||
|
||||
|
||||
return false; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public boolean isRoot() { |
||||
try { |
||||
return RemoteDesignAuthenticateUtils.isRoot(WorkspaceServerContext.currentUsername()); |
||||
} catch (Exception e) { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public <T> T get(Class<T> type) { |
||||
|
||||
|
||||
return client.getPool().get(type); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue