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